mysql auto position_启用auto_position=1一直报错

启用auto_position=1一直报错 Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.', Error_code: 1236

gtid中一些变量的理解

Retrieved_Gtid_Set: 接收到gtid集合

Executed_Gtid_Set: slave 已经执行过gtid集合,这个值使用从库的gtid_executed 这个变量初始化

gtid_executed:执行过的gtid集合

gtid_purged:已经被purge清除掉gtid集合

在执行start slave  的时候 ,如何计算起始的gtid值/集合

在从库已经执行的gtid集合

gtid_executed={0dd527e9-af3e-11e8-9ed6-00505683b926:1-62,0dd527e9-af3e-11e8-9ed6-00505683b927:1-3,87cf7b97-c393-11e8-845b-005056a95814:1,bb014309-e1a6-11e8-b284-00505683b926:1-12,c488995b-e256-11e8-abb7-00505683b926:1-9}

主库上执行的gtid集合

master_gtid_executed = { c488995b-e256-11e8-abb7-00505683b926:1-10 }

主库发送给从库的第一个gtid值(也可能是一个集合)

send_first_gtids={master_gtid_executed - gtid_executed}

send_first_gtids = { c488995b-e256-11e8-abb7-00505683b926:10 }

这个时候就计算出master需要发送给slave的第一个gtid值/集合,

如果这个值已经被master purge清理掉了(也就说在master的binlog文件中找不到了)

slave 就会报错  1236 错误

具体报错如下 :

Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.', Error_code: 1236

对于这种错误 有两种解决方案

1.重做slave

2.找到历史的binlog文件,收到从binlog文件cp出需要的gtid集合日志在slave执行(这里需用到mysqlbinlog --include-gtids ),重新初始化从库的gtid_executed 的值

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值