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 eventMaster_Host: 192.168.194.74Master_User: replicatorMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.001274Read_Master_Log_Pos: 1045327404Relay_Log_File: 3_dbbackup.003821Relay_Log_Pos: 617884398Relay_Master_Log_File: mysql-bin.001273Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1594Last_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: 0Exec_Master_Log_Pos: 617884110Relay_Log_Space: 3192816253Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 1594Last_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: 13Master_SSL_Crl: Master_SSL_Crlpath: Using_Gtid: NoGtid_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了。