MySQL同步错误1594

查资料:https://blog.51cto.com/wuwei5460/1552798

按照文章描述步骤,记录如下:

一、问题描述,提取关键信息

Master_Log_File: mysql-bin.004018

Relay_Log_File: mysql-relay-bin.000327

Relay_Master_Log_File: mysql-bin.003986

Last_Errno: 1594

Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

Exec_Master_Log_Pos: 23535261

二、原因分析

      报错信息为从库“无法读取relay log 里的条目”,可能原因为master库的binglog错误,或slave库的中继日志错误。或者为网络问题及bug原因。

      一般是由于网络故障或slave库压力过大,导致relay-log格式错误造成的。

解决方法:找到当前已经同步的时间点,重新设置主从同步,就会产生新的中继日志,恢复正常。

三、问题处理

从"show  slave  status\G"的输出中,找到如下信息:

Relay_Master_Log_File: mysql-bin.003986  //slave库已读取的master的binlog

Exec_Master_Log_Pos: 23535261     //在slave上已经执行的position位置点

停掉slave,以slave已经读取的binlog文件,和已经执行的position为起点,重新设置同步。会产生新的中继日志,问题解决。

stop slave;

change master to master_log_file='mysql-bin.003986',master_log_pos="23535261";

start slave;


重新指定同步位置

四、验证结果

再次查看,错误已经解决,slave 开始追 master 的日志


同步追赶

Seconds_Behind_Master: 151546

监控此参数,离主从同步时间减少。

你可能感兴趣的:(MySQL同步错误1594)