情景

从库从主库的一天前的备份恢复后,出现了如下错误:

SITION = 1, but the master has purged binary logs containing GTIDs that the slave requires

该实例的每秒事务在大概4K左右,所以主库上Binlog很快被冲走了。但由于多数为更新类的事务,老数据总会被最新的更改覆盖成正确的记录。零星会有插入或者删除的操作

处理办法

  • 重新获取备份
    • 数据量过大,容易造成主库性能抖动
  • 根据业务特性,跳过被冲掉部分的更改信息

处理过程

set sql_log_bin=0;
stop slave;
reset master;
set global gtid_purged='90ceab5e-5a7f-490e-8103-caf8219a3075:1-88512715043,d54dc219-8fe7-11e8-826f-246e96637188:1-3,e154990a-8fe7-11e8-a92a-246e9661e038:1-3,ec803005-8fe7-11e8-af66-246e9663e440:1-3';
set global slave_exec_mode=IDEMPOTENT;
start slave;


参考