MySQL Relay log read failure beheben

Vor nicht allzu langer Zeit habe ich, mit Hilfe dieses Artikels, eine MySQL Master-/Slave-Replikation aufgebaut.

Heute ist es dann passiert. Nach einem Absturz des MySQL-Slave Servers funktionierte die Replikation nicht mehr. Die Ausgabe von

mysql> SHOW SLAVE STATUS\G

offenbarte folgende Fehlermeldung:

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 diesem Fall konnte die Replikation mit den folgenden Schritten repariert werden.

  1. STOP SLAVE;
  2. SHOW SLAVE STATUS\G
  3. Notiert die Einträge für ‚Relay_Master_Log_File‘ und ‚Exec_Master_Log_Pos‘
  4. RESET SLAVE;
  5. CHANGE MASTER TO MASTER_LOG_FILE=’Name_des_Master_Logfiles aus Schritt 3′, MASTER_LOG_POS=exec_master_log_pos aus Schritt 3;
  6. START SLAVE

Mit den oben beschriebenen Schritten werden alle Relay-Logs vom Slave-Server entfernt. Damit werden auch die evtl. korrupten Logs entfernt. Die Replikation beginnt anschließend genau an dem Punkt, an dem sie zuvor abgerissen ist, indem ein neues Binärlog vom Master-Server angefordert wird.

Und siehe da, ich hatte meine Replikation wieder am Fliegen.

Ein Gedanke zu „MySQL Relay log read failure beheben

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert