我的树莓派作为博客的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上操作)。
找到断点
Shell
show slave status\G;
1
showslavestatus\G;
找到Relay_Master_Log_File和Exec_Master_Log_Pos,表示目前同步到了master的哪个binlog文件,以及binlog文件的哪个偏移量。
停止主从
Shell
stop slave;
1
stopslave;
修改同步起点
Shell
change master to master_log_file='bin.000001' , master_log_pos=242312863;
1
changemastertomaster_log_file='bin.000001',master_log_pos=242312863;
重启同步
Shell
start slave;
1
startslave;
重新检查同步是否恢复:
Shell
show slave status\G;
1
showslavestatus\G;
如果文章帮助了你,请帮我点击1次谷歌广告,或者微信赞助1元钱,感谢!
知识星球有更多干货内容,对我认可欢迎加入: