After power failures, our MySQL slaves sometimes stop replicating. The error is:
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 the past, I would restore replication from another slave, but this method seems much better in that it’s faster and easier.
Get the Relay_Master_Log_File and Exec_Master_Log_Pos from “show slave status\G”;
reset slave to that point, and let it recover by itself as follows:
Be careful, using Relay_Master_Log_File value from “show slave status\G” for master_log_file, not Master_Log_File value. They’re the same in this case.mysql> slave stop;
Query OK, 0 rows affected (0.00 sec)mysql> change master to master_log_file=’LBMS-bin.000012′,master_log_pos=221245113;
Query OK, 0 rows affected (0.04 sec)mysql> start slave;
Query OK, 0 rows affected (0.00 sec)