mysql中Relay log read failure master slave的解决方法

发布时间:2020-08-20编辑:脚本学堂
本文介绍下,mysql中出现Relay log read failure master slave错误的解决方法,有需要的朋友参考下。

show slave status G  提示如下错误
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.

原因分析:
在传输master log-bin时,因网络原因或slave机压力问题,造成log-relay文件格式错误

找到如下的解决方法,分享给大家。
方法一:
找到relay-log.info,第一行记录了当前正在执行的log-relay文件名,找到该文件的下一个文件。
使用mysqlbinlog查看该文件,在#98这行有Rotate to log-bin.000004 pos: 4等信息,这是目前slave停止的位置。
在slave上重新指定同步位置,重新执行:
 

复制代码 代码示例:
change master to
master_host='1.1.1.1',
master_user='repl',
master_password='111111',
master_port=3306,
master_log_file='log-bin.000004',
master_log_pos=4;
slave start;
show slave statusG;

方法二:
stop slave之后,重新reset slave;
再次查看,此时数据已经开始同步了。

希望以上的方法,可以帮助大家解决问题。