MySQL 主从复制:二进制日志已清除,错误 1236可以恢复复制吗?

问题描述

场景如下:

MysqL 主服务器正在写入以下二进制日志文件pccodb22-binlog.000677

奴隶正在读取这个文件。主服务器在冬天关闭pccodb22-binlog.000677因到期而被清除。

现在,所有从服务器复制失败,出现以下 IO 错误Got Fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

我知道奴隶们已经了解了 pccodb22-binlog.000677 中的最新情况。

master 中有几个新的二进制日志:

pccodb22-binlog.000678
pccodb22-binlog.000679
pccodb22-binlog.000680

如何在不破坏复制同步的情况下使从站保持最新状态?

我是这样想的:

STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='pccodb22-binlog.000678',MASTER_LOG_POS=4;
START SLAVE;
#wait for the slave to reach the end of this binlog
STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='pccodb22-binlog.000679',MASTER_LOG_POS=4;
START SLAVE;
#wait for the slave to reach the end of this binlog
STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='pccodb22-binlog.000680',MASTER_LOG_POS=4;
START SLAVE;

或者,以下就够了吗?

STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='pccodb22-binlog.000678',MASTER_LOG_POS=4;
START SLAVE;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)