故障现象:
在使用xtrabackup部署新的slave时遇到如下error:
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.'
xtrabackup_slave_info中拿到的gtid_purged值是:uuid:239-5573669544
故障分析过程:
初按常规方法重新设置gtid_purged,,重启同步后仍然报同样错误:
reset slave all;
reset master;
set global gtid_purged='uuid:239-5573669544';
change master ... master_auto_position=1;
start slave;
后通过分析发现,master和做backup的slave上面的gtid_purged值不同:
master: uuid:1-5573669544
slave: uuid:239-5573669544
所以新的slave在配置了gtid_purged: uuid239-5573669544之后,会去master上尝试读取[1-239]这个范围的binlog,这是造成此次ERROR的原因。
解决:
在新的slave上配置set global gtid_purged='uuid:1-5573669544';即可
灵魂配图: