MySQL从库不能同步,报错Relay log read failure


问题:MySQL从库的数据不能同步,从库SHOW SLAVE STATUS提示如下错误:

Last_SQL_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.


尝试:

sql线程无法读取relay-log,估计relay-log损坏!

尝试重启slave

stop slave;

start slave;

查看状态仍旧是该错误!


解决办法:

(1)查看MySQL的错误日志,记录最后两个数字:

tail /opt/mysql_log/mysql_error.err
2015-01-23 16:34:30 1962 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
2015-01-23 16:34:30 1962 [ERROR] Slave SQL: 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. Error_code: 1594
2015-01-23 16:34:30 1962 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'logbin.000054' position 1278235

(2)停止从库复制     

stop slave;

(3)尝试重新定位主库 

change master to master_log_file='logbin.000054',master_log_pos=1278235;

(4)开启从库复制     

start slave;


你可能感兴趣的:(mysql,slave,mysqlbinlog)