mysql主从中断原因_mysql主从中断

Mysql主从复制中断一例

收到mysql主从中断报警,马上登上服务器查看,发现是中继日志损坏。

Show slave status\G,提示中继日志损坏,按以往的做法,根据提示重新指定合适的日志文件,pos点。

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.

2.从MySQL5.5.X版本开始,增加了relay_log_recovery参数,这个参数的作用是:当slave从库宕机后,假如relay-log损坏了,导致一部分中继日志没有处理,则自动放弃所有未执行的relay-log,并且重新从master上获取日志,这个参数是默认关闭的。做主从的时候没有开启这项参数。修改my.cnf,添加这两项。(skip-slave-start ,mysql服务启动跳过自动启动主从复制,以免产生新的问题),relay_log_recovery支持不支持动态修改。所以修改配置文件,重启MySQL服务,启动slave线程

#####my.cnf加这两项

relay_log_recovery = 1

skip-slave-start = 1

######################

3.再查看Show slavestatus\G,同步已经恢复,正在应用中继日志,等同步完成之后,然后随机抽查一个表,数据一致

#########################################################

Relay_Master_Log_File: mysql-bin.000642

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

##############################################

Master_SSL_Key:

Seconds_Behind_Master: 0

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 0

Last_SQL_Error:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值