从库先执行global.gtid_executed, 再主库执行, 发现从库gtid更大
本帖最后由 earl86 于 2022-10-13 14:01 编辑os: CentOS Linux release 7.7.1908 (Core)
mysql版本: Server version: 5.7.35-38-log Percona Server (GPL), Release 38, Revision 3692a61
异步复制
相关参数:
| binlog_transaction_dependency_tracking | WRITESET |
| sync_binlog | 1 |
| innodb_flush_log_at_timeout | 1 |
| innodb_flush_log_at_trx_commit | 1 |
| binlog_gtid_simple_recovery | ON |
| enforce_gtid_consistency | ON |
| gtid_mode | ON |
从库参数配置
mysql> show variables like '%read_only%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_read_only | OFF |
| read_only | ON |
| super_read_only | ON |
| transaction_read_only | OFF |
| tx_read_only | OFF |
+-----------------------+-------+
5 rows in set (0.00 sec)
其他参数
| slave_exec_mode | STRICT |
| slave_parallel_type | LOGICAL_CLOCK |
| slave_parallel_workers | 48 |
| slave_preserve_commit_order| ON |
同步状态正常:
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.100
Master_User: replusername
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.137285
Read_Master_Log_Pos: 1025249001
Relay_Log_File: mysql-relay-bin.411852
Relay_Log_Pos: 1024538398
Relay_Master_Log_File: mysql-bin.137285
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1024538193
Relay_Log_Space: 1025249528
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 1
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 168952092
Master_UUID: 32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 1e867cf3-d162-11ea-949e-ac1f6ba5c058:57304923998-57324005921,
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:1-69282333916
Executed_Gtid_Set: 1e867cf3-d162-11ea-949e-ac1f6ba5c058:1-57324005921,
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:1-69282333910,
c7b2cce0-53dc-11eb-b0e3-ac1f6bcb6a16:1
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
检查脚本先连接从库执行select @@global.gtid_executed,然后再连接主库执行select @@global.gtid_executed 对比主从差异
不停的check偶尔会发现从库上的gtid更大一点
slave:
1e867cf3-d162-11ea-949e-ac1f6ba5c058:1-57324005921,
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:1-69283791247,
c7b2cce0-53dc-11eb-b0e3-ac1f6bcb6a16:1
master:
1e867cf3-d162-11ea-949e-ac1f6ba5c058:1-57324005921,
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:1-69283791244,
c7b2cce0-53dc-11eb-b0e3-ac1f6bcb6a16:1
发现master缺少的gtid:
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:69283791245-69283791247
帖子中最后一行是啥意思
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:69283791245-69283791247
另外,有没可能是你自己看花眼,弄错master、slave的结果,哈哈 yejr 发表于 2022-10-13 13:40
帖子中最后一行是啥意思
32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:69283791245-69283791247
主库缺少的gtid嘛
SELECT GTID_SUBTRACT('slave_gtid', 'master_gtid');
SELECT GTID_SUBTRACT('1e867cf3-d162-11ea-949e-ac1f6ba5c058:1-57324005921,32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:1-69283791247,c7b2cce0-53dc-11eb-b0e3-ac1f6bcb6a16:1', '1e867cf3-d162-11ea-949e-ac1f6ba5c058:1-57324005921,32f6db3b-1843-11ec-84c1-ac1f6bcb6ad6:1-69283791244,c7b2cce0-53dc-11eb-b0e3-ac1f6bcb6a16:1');
主从肯定没弄错 哈哈
earl86 发表于 2022-10-13 13:55
主库缺少的gtid嘛
SELECT GTID_SUBTRACT('slave_gtid', 'master_gtid');
SELECT GTID_SUBTRACT('1e867cf3 ...
能稳定复现的话,可以去提交bug了 :)
页:
[1]