mysql双主架构——主从断连

mysql双主架构
日志报错信息:
Cannot replicate to server with server_uuid='xxx' because the present server has purged required binary logs. The connecting server needs to replicate the missing transactions from elsewhere, or be replaced by a new server created from a more recent backup. To prevent this error in the future, consider increasing the binary log expiration period on the present server. The missing transactions are 'xxx'.

2023-05-23T11:07:25.024232Z 5 [System] [MY-010562] [Repl] Slave I/O thread for channel '': connected to master 'xxxx@ip:3306',replication started in log 'mysql-bin.000107' at position 546946688 2023-05-23T11:07:25.025386Z 5 [ERROR] [MY-010557] [Repl] Error reading packet from server for channel '': Cannot replicate because the master purged required binary logs. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. The GTID set sent by the slave is xxx', and the missing transactions are '@@GTID' (server_errno=1236) 2023-05-23T11:07:25.025414Z 5 [ERROR] [MY-013114] [Repl] Slave I/O for channel '': Got fatal error 1236 from master when reading data from binary log: 'Cannot replicate because the master purged required binary logs. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. The GTID set sent by the slave is 'xxx'
分别查询

MySQL>show global variables like'%gtid%'\G

获得A

Variable_name: gtid_purged
        Value: 86bdc8ab-e1ba-11ed-965c-005056ad6d03:1-67278259:76207330-76207504

和另一台的B

Variable_name: gtid_executed
        Value:86bdc8ab-e1ba-11ed-965c-005056ad6d03:1-78248170

由此可得知,A的数据比B的数据少,所以应该是之前断电重启后,A复制B的数据出现了问题,造成主从断连

解决方法:
B

MySQL>stop slave;
MySQL>reset slave all;

A

MySQL>stop slave;
MySQL>reset master;
MySQL>set @@GLOBAL.GTID_PURGED='@@GTID';
--@@GTID为之前日志中显示传输失败的日志
MySQL>change master to master_host=‘ip’,master_port='port',master_auto_position=1;
MySQL>start slave;
MySQL>show slave status\G

             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

B

MySQL>start slave;
MySQL>show slave status\G


             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

恢复正常!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值