mysql从库relay_log一直不变_mysql主从Relay log read failure解决

我的树莓派作为博客的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元钱,感谢!

c68972f84f7c4f47f59a1f69f0608e10.png

知识星球有更多干货内容,对我认可欢迎加入:

6c9a48ad74e3675cedd6ca98c1fd0a1f.png

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值