recovery from corrupted mysql replication

本文介绍了一种常见的MySQL复制错误——relay log corruption,并提供了详细的解决步骤。通常由网络问题导致,可通过停止从节点服务并跳过损坏的日志段来解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

直接把我编辑的公司wiki复制过来吧

Relay log corruption example:

You can get error info after 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.

In most cases, it should be caused by a network problem which leads to a corruption of relay log. And this problem can be fixed quite easily. So when you get error, first try this to see if it works.
1. stop the slave and get info by "SHOW SLAVE STATUS;"

2. Note down values of these two fields: "Relay_Master_Log_File","Exec_Master_Log_Pos"

For example>Relay_Master_Log_File=mysql-bin.000287>Exec_Master_Log_Pos: 972239835

3. Bypass the corrupted relay log by

mysql> CHANGE MASTER TO
mysql> MASTER_LOG_FILE='mysql-bin.000287',
mysql> MASTER_LOG_POS=972239835;
mysql> START SLAVE;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值