Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons(
Posted 雅冰石
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons(相关的知识,希望对你有一定的参考价值。
一 问题描述
机房搬迁后启动从库,数据库起来了,但是从库复制报错:
mysql> show slave status \\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 172.16.28.90
Master_User: rep_sa
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: logbin.000323
Read_Master_Log_Pos: 7712883
Relay_Log_File: SCDY-GED-PIM-S-relay-bin.000046
Relay_Log_Pos: 140291861
Relay_Master_Log_File: logbin.000322
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB: pim
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: 140291718
Relay_Log_Space: 148007891
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: 1
1 row in set (0.00 sec)
二 出错原因
服务器断电导致从库的relay log损坏,从而导致从库复制线程报错。
三 解决办法
重新配置主从复制,从复制停止时执行到的位置(Relay_Master_Log_File及Exec_Master_Log_Pos)开始重新读取主库的binlog日志
mysql> stop slave ;
Query OK, 0 rows affected (0.00 sec)
mysql> reset slave all;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_host='172.16.28.90',master_port=3306,master_log_file='logbin.000322',master_log_pos=140291718,master_user='rep_sa',master_password='复制用户的密码';
Query OK, 0 rows affected (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status \\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.28.90
Master_User: rep_sa
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: logbin.000323
Read_Master_Log_Pos: 7933898
Relay_Log_File: SCDY-GED-PIM-S-relay-bin.000003
Relay_Log_Pos: 1463458
Relay_Master_Log_File: logbin.000323
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: pim
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1463315
Relay_Log_Space: 7934657
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: 816072
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
--本篇文章主要参考自:https://blog.csdn.net/shaochenshuo/article/details/60574721
以上是关于Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons(的主要内容,如果未能解决你的问题,请参考以下文章