当前位置:网站首页>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
边栏推荐
猜你喜欢

Remember the major performance problems caused by a TCP packet loss

JS modify the key value of the object array
![[day02] Introduction to data type conversion, operators and methods](/img/81/e2c49a4206e5d0d05308a1fc881626.png)
[day02] Introduction to data type conversion, operators and methods

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

Okaleido ecological core equity Oka, all in fusion mining mode

Influxdb basic understanding

Okaleido生态核心权益OKA,尽在聚变Mining模式

js修改对象数组的key值

Practice of microservice in solving Library Download business problems

一张图看懂KingbaseES V9
随机推荐
Plato farm has a new way of playing, and the arbitrage eplato has secured super high returns
The difference between ArrayList and LinkedList
Ref Hook
Network knowledge corner | it only takes four steps to teach you to use SecureCRT to connect to ENSP. You must see the operation guide of common tools
els_ 画矩形、代码规划和备份
The new Internet era has come. What new opportunities will Web 3.0 bring us
VSCode开启Pull Request更新代码分支可视化新篇章
Prometheus node exporter common monitoring indicators
redux三大核心
Okaleido tiger will log in to binance NFT in the second round, or continue to create sales achievements
JMeter learning notes 004-csv file line number control cycle times
【软件工程期末复习】知识点+大题详解(E-R图、数据流图、N-S盒图、状态图、活动图、用例图....)
安全第四次课后练习
Wechat input component adds a clear icon, and clicking clear does not take effect
地平线 旭日X3 PI (四) 板上运行(未写完)
How to set user-defined display for Jiaming Watch
Final review of management information system
使用WebMvcConfigurer进行接口请求拦截进行中增强(附源码)
Standard C language 11
佳明手表怎么设置用户定制显示