当前位置:网站首页>Technology sharing | gtid that needs to be configured carefully_ mode
Technology sharing | gtid that needs to be configured carefully_ mode
2022-07-27 04:33:00 【ActionTech】
author : Wang Yarong
DBA, be responsible for MySQL Daily problem handling and DMP Product maintenance .
In this paper, the source : Original contribution
* Produced by aikesheng open source community , Original content is not allowed to be used without authorization , For reprint, please contact the editor and indicate the source .
Background information :
This article is related to the problems found in a daily operation and maintenance process . Questions as follows :
The customer takes over the database for backup , An error has occurred :
error : manual backup error: rpc error: code = Unknown desc = task(manual_backup_manual_mysql-2db0mi_2022_07_09_22_30_33_mysql-2db0mi_2022_07_09_22_30_33) is failed,
reason is parse last gtid from file(/dmp/mysql/backup/3306/backup-616678719/tmp/backup.log) failed\n\n Rollback log :\n\t
analysis :
Because the error is caused by parsing the last one from the file gtid Failure , So check first gtid Parameters
In the database gtid Parameters :gtid_mode=OFF_PERMISSIVE( The database was restarted after taking over )

Check the configuration file gtid_mode The relevant information is

Inquire relevant information through the official website , hear gtid_mode Yes 4 It's worth :OFF;OFF_PERMISSIVE;ON_PERMISSIVE;ON

In this configuration , The platform cannot start the slave high availability configuration , Copying from the library will report an error :
Slave_IO_Running: No
Slave_SQL_Running: Yes
......
Last_IO_Errno: 1593
Last_IO_Error: The replication receiver thread cannot start in AUTO_POSITION mode: the master has GTID_MODE = OFF_PERMISSIVE instead of ON.
Last_SQL_Errno: 0
Last_SQL_Error:
And the database at this time cannot be backed up
Local testing :
1) Set the database configuration file's gtid_mode It is amended as follows =1, And restart the database

2) After restart, log in to the database to view gtid_mode Parameter values , Found after restart gtid_mode=OFF_PERMISSIVE

3) Set the database configuration file's gtid_mode It is amended as follows =ON, And restart the database

4) After restart, log in to the database to view gtid_mode Parameter values , Found after restart gtid_mode=ON

It can be concluded that :gtid_mode = 1 The effect is not equal to gtid_mode = ON, It's equal to gtid_mode = OFF_PERMISSIVE
because gtid_mode The type of parameter is Enumeration, So variables have aliases of multiple values
| gtid_mode Variable | The configuration file can write values |
|---|---|
| OFF | 0 |
| OFF_PERMISSIVE | 1 |
| ON_PERMISSIVE | 2 |
| ON | 3 |
mysql> show variables like "gtid_mode";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| gtid_mode | OFF |
+---------------+-------+
1 row in set (0.01 sec)
mysql> set global gtid_mode=0;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like "gtid_mode";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| gtid_mode | OFF |
+---------------+-------+
1 row in set (0.00 sec)
mysql> set global gtid_mode=1;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like "gtid_mode";
+---------------+----------------+
| Variable_name | Value |
+---------------+----------------+
| gtid_mode | OFF_PERMISSIVE |
+---------------+----------------+
1 row in set (0.01 sec)
mysql> set global gtid_mode=2;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like "gtid_mode";
+---------------+---------------+
| Variable_name | Value |
+---------------+---------------+
| gtid_mode | ON_PERMISSIVE |
+---------------+---------------+
1 row in set (0.00 sec)
mysql> set global gtid_mode=3;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like "gtid_mode";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| gtid_mode | ON |
+---------------+-------+
1 row in set (0.00 sec)
resolvent :
In the configuration file gtid_mode = 1 Change it to gtid_mode = ON

Enter... In the database
mysql> set global GTID_MODE = ON_PERMISSIVE;
Query OK, 0 rows affected (0.02 sec)
// Execute the following commands on the master and slave nodes , Check whether anonymous transactions are consumed , It's best to check more times , To confirm that the value of this parameter is 0
mysql> SHOW STATUS LIKE 'ONGOING_ANONYMOUS_TRANSACTION_COUNT';
+-------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------+-------+
| Ongoing_anonymous_transaction_count | 0 |
+-------------------------------------+-------+
1 row in set (0.00 sec)
mysql> set global GTID_MODE = ON;
Query OK, 0 rows affected (0.02 sec)
After modification, the database can be successfully backed up
summary :
In daily operation and maintenance , We are used to setting it to ON The parameter of is written as =1, however gtid_mode=1 But not will gtid_mode Set to ON
So be sure to write gtid_mode=ON, perhaps gtid_mode=3
Reference resources :
https://dev.mysql.com/doc/mysql-replication-excerpt/8.0/en/replication-options-gtids.html#sysvar_gtid_mode
https://dev.mysql.com/doc/mysql-replication-excerpt/8.0/en/replication-mode-change-online-enable-gtids.html
边栏推荐
- Pinia入门到精通,Pinia使用全流程,包含state,actions,getters,以及如何解构,进行响应,actions使用的多种方法
- Introduction to regular expressions of shell, general matching, special characters: ^, $,., * Character range (brackets): [], special characters: \, matching mobile phone number
- els 兼容性DC、传递图片到窗口
- BSN IPFS(星际文件系统)专网简介、功能、架构及特性、接入说明
- 微服务的feign调用header头被丢弃两种解决方案(附源码)
- 【独立站建设】跨境电商出海开网店,首选这个网站建设!
- Do you know about wechat merchant billing?
- 法解析的外部符号 “public: virtual __cdecl nvinfer1::YoloLayerPlugin::~YoloLayerPlugin(void)“ “public: virtua
- Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号
- 电商分账系统重要吗,平台应该如何选择分账服务商呢?
猜你喜欢

People don't talk much, engineers don't talk much

Unity:Resource Merging、Static Batching、Dynamic Batching、GPU Instancing

干货 | 独立站运营怎么提高在线聊天客户服务?

Install and configure Debian on a wired network

网工知识角|只需四个步骤,教会你使用SecureCRT连接到eNSP,常用工具操作指南必看

佳明手表怎么设置用户定制显示

The project parameters are made into configurable items, and the @configurationproperties annotation is used

无有线网络下安装并配置debian

redux三大核心

卷积神经网络——24位彩色图像的卷积的详细介绍
随机推荐
The project parameters are made into configurable items, and the @configurationproperties annotation is used
【软件工程期末复习】知识点+大题详解(E-R图、数据流图、N-S盒图、状态图、活动图、用例图....)
Elastic certification test: 30 day FastPass Study Guide
Brightcove任命Dan Freund为首席营收官
IIC 通信协议 (一)
[leetcode] day104 no overlapping interval
GenericServlet为什么有两个init方法
Some common instructions in JVM tuning
P1438 无聊的数列 线段树+差分
How to set user-defined display for Jiaming Watch
Echart柱状图中数据显示在图上方
Remember the major performance problems caused by a TCP packet loss
ELS compatibility DC, transfer pictures to window
els 兼容性DC、传递图片到窗口
Deep analysis - dynamic memory management
人很话不多,工程师不耍嘴皮子
sram、dram、sdram、ddr的区别和用途
shel自动设置目录权限
【C语言】递归详解汉诺塔问题
JMeter学习笔记004-CSV文件行数控制循环次数