解决Mysql replication error 1594 - Relay log read failure - Could not parse relay log event entry

Mysql复制错误1594-中继日志读取失败-无法解析中继日志事件条目

错误信息:

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.

有时mysql复制会因中继二进制日志损坏而崩溃,并且无法通过简单的“ start slave”命令将其重启

要检查当前从站状态,请执行命令:

show slave status\G;

您应该看到类似以下结果:

************************** 1. row ***************************

               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.194.74
                  Master_User: replicator
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.001274
          Read_Master_Log_Pos: 1045327404
               Relay_Log_File: 3_dbbackup.003821
                Relay_Log_Pos: 617884398
        Relay_Master_Log_File: mysql-bin.001273
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1594
                   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.
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 617884110
              Relay_Log_Space: 3192816253
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 1594
               Last_SQL_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.
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 13
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
                   Using_Gtid: No
                  Gtid_IO_Pos: 
      Replicate_Do_Domain_Ids: 
  Replicate_Ignore_Domain_Ids: 
                Parallel_Mode: conservative

应该注意的重要值是 Relay_Master_Log_File和 Exec_Master_Log_Pos。 将需要它们来正确重新启动从属服务器上的复制。

要重新启动复制: “master_log_file = mysql-bin.001273”,“master_log_pos = 617884398”

STOP SLAVE;
RESET SLAVE;
CHANGE MASTER TO master_log_file='mysql-bin.001273', master_log_pos=617884110;
START SLAVE;

要检查复制是否再次起作用,请再次执行命令:

show slave status\G;

在以同步方式调用从库之前,请从状态命令中检查参数 Seconds_Behind_Master 的值。主从同步延迟的状态(5187秒):

Seconds_Behind_Master: 5187

在接下来的几分钟内,复制再次与主服务器同步,复制滞后为0s

Seconds_Behind_Master: 0

这是时候,就可以在生产中再次开始使用mysql slave了。

你可能感兴趣的:(日常工作问题处理,mysql,数据库,服务篇,linux,mysql,服务器,运维)