Slave has more GTIDs than the master has, using the master‘s SERVER_UUID

本文讲述了机房掉电导致数据库非正常关闭后,如何通过设置GTID和sync_binlog来解决从库报错的问题,包括主库调整GTID和从库重置 slave。关键在于理解sync_binlog的作用并确保数据一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

机房掉电,数据库非正常关机。MySQL拉起后,从库报如下错误。

  Last_IO_Errno: 1236
  Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Slave has more GTIDs than the master has, using the master's SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been'

Executed_Gtid_Set: 78baf053-b460-11ea-9b26-b82a72d58ac1:1-3,
f738f1f9-b466-11ea-a7b4-b82a72d58ac1:1-169102298

原因: 没有设置sync_binlog = 1

解决方法:

1.主库设置比从库大的GTID.

mysql> SET SESSION GTID_NEXT='f738f1f9-b466-11ea-a7b4-b82a72d58ac1:169102299';    
Query OK, 0 rows affected (0.00 sec)

mysql> begin ; commit; set gtid_next='automatic';

 

2.从库

stop slave;start slave; show slave status; 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值