当前位置:网站首页>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
边栏推荐
- Chapter 6: cloud database
- STM32 serial port based on Hal library accepts interrupts and idle interrupts
- els 兼容性DC、传递图片到窗口
- Overview of communication protocols
- 【day02】数据类型转换、运算符、方法入门
- PX4模块设计之十二:High Resolution Timer设计
- BSN IPFS(星际文件系统)专网简介、功能、架构及特性、接入说明
- els 方块显示原理
- Practice of microservice in solving Library Download business problems
- Playwright web crawler actual battle case sharing
猜你喜欢

结构型模式-外观(Facade)模式
![Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号](/img/31/ed0d8c1a5327059f2de7493bec1c6c.png)
Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号

Install and configure Debian on a wired network

F - Pre-order and In-order(Atcoder 255)

使用WebMvcConfigurer进行接口请求拦截进行中增强(附源码)

HEAD detached from origin/...导致push失败

Convolution neural network -- convolution of gray image

Okaleido ecological core equity Oka, all in fusion mining mode

Remember the major performance problems caused by a TCP packet loss

The data in echart histogram is displayed at the top of the chart
随机推荐
How to set user-defined display for Jiaming Watch
There are two solutions for the feign call header of microservices to be discarded (with source code)
sram、dram、sdram、ddr的区别和用途
利用JSON类型在mysql中实现数组功能
Differences and uses of SRAM, DRAM, SDRAM and DDR
【独立站建设】跨境电商出海开网店,首选这个网站建设!
els_ Rectangle drawing, code planning and backup
[untitled]
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
Remember the major performance problems caused by a TCP packet loss
Word/Excel 固定表格大小,填写内容时,表格不随单元格内容变化
Wechat input component adds a clear icon, and clicking clear does not take effect
Elastic certification test: 30 day FastPass Study Guide
标准C语言13
[machine learning network] BP neural network and deep learning-6 deep neural networks (DNN)
从零开始C语言精讲篇4:数组
Sed output specified line
Ribbon load balancing principle and some source codes
Convolution neural network -- a detailed introduction to convolution of 24 bit color images
e.target与e.currentTarget的区别