recovery from corrupted mysql replication

2016-05-27 看看来
recovery from corrupted mysql replication
 
直接把我编辑的公司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;

用户评论
开源开发学习小组列表