MySQL replication problem: Corrupted relay log

Topics: MySQL replication

A MySQL follower stores replication events in local relay logs before applying them. If a relay log becomes corrupted after a crash, replication can stop; this note describes how to request the events again from the source.

Subtopics

Restore replication

If a follower node crashed, its local relay log could have become corrupt. The replication status will show the following error message:

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.

You can repair this by restarting replication from its current position as displayed in the replication status fields Master_Log_File and Read_Master_Log_Pos. This forces the follower node to request the binary log data from the leader node again, repairing its local relay files in the process.

The statements to make the current position the new replication position are:

STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE="<binlog_file>", MASTER_LOG_POS=<binlog_pos>;
START SLAVE;

Bookmarks

Questions