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;


本文出自 “◆峰回路转◇2015启程◆” 博客,请务必保留此出处http://huangfuff.blog.51cto.com/2632203/1607491

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。