我的树莓派作为博客的mysql slave,一直在备份数据。
前几日折腾树莓派,频繁重启树莓派,可能导致relay log损坏了,show slave status显式主从同步错误:
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.
解决方法如下(在slave上操作)。
找到断点
1 |
show slave status\G; |
找到Relay_Master_Log_File和Exec_Master_Log_Pos,表示目前同步到了master的哪个binlog文件,以及binlog文件的哪个偏移量。
停止主从
1 |
stop slave; |
修改同步起点
1 |
change master to master_log_file='bin.000001' , master_log_pos=242312863; |
重启同步
1 |
start slave; |
重新检查同步是否恢复:
1 |
show slave status\G; |
如果文章帮助您解决了工作难题,您可以帮我点击屏幕上的任意广告,或者赞助少量费用来支持我的持续创作,谢谢~
