温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

启用auto_position=1一直报错

发布时间:2020-06-07 15:39:09 来源:网络 阅读:2954 作者:dengwang123 栏目:MySQL数据库


启用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 的值


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI