Relay log read failure解决办法

mysql数据库主从同步中断了,错误提示:

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.


 解决方法:

1、找到relay-log.info,第一行记录了当前正在执行的log-relay文件名

例如:

./slave-relay-bin.001226

719572592

mysql-bin.001522

719572447


2、找到该文件的下一个文件 使用mysqlbinlog查看该文件

比方:mysqlbinlog ./slave-relay-bin.001226

看到:

Rotate to slave-relay-bin.001228  pos: 4

3、登陆mysql 

stop slave;

change master to

master_host='192.168.1.168',master_user='复制账号',master_password='复制密码',master_log_file='slave-relay-bin.001227',master_log_pos= 4;

start slave;

show slave status\G;

看到同步又开始正常了


以上方法可以不需要去拷贝数据到从库 重新做主从同步