偶尔因为断电导致mysql slave 出现复制错误“Could not parse relay log event entry”
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.
?
先查询下状态
show slave status \G
?
Master_Host: 192.168.2.51
? ? ? ? ? ? ? ? Master_User: backupuser
? ? ? ? ? ? ? ? Master_Port: 3306
? ? ? ? ? ? ? Connect_Retry: 60
? ? ? ? ? ? Master_Log_File: mysql-bin.000078
? ? ? ? Read_Master_Log_Pos: 984673998
? ? ? ? ? ? ?Relay_Log_File: memcached-relay-bin.000039
? ? ? ? ? ? ? Relay_Log_Pos: 747157846
? ? ? Relay_Master_Log_File: mysql-bin.000078
? ? ? ? ? ?Slave_IO_Running: Yes
? ? ? ? ? Slave_SQL_Running: No
?
? ? ? ? ? Skip_Counter: 0
? ? ? ? Exec_Master_Log_Pos: 747157709
? ? ? ? ? ? Relay_Log_Space: 984679197
?
如果可以确定主服务器没有问题的话,那么重置下从服务器的同步位置就可以了。
如上可以对应的指令为:
stop slave;
CHANGE MASTER TO ?MASTER_LOG_FILE = 'mysql-bin.000078', MASTER_LOG_POS =747157709;
start slave;
再用?show slave status \G 查看状态。如下:
Master_Log_File: mysql-bin.000078
? ? ? ? Read_Master_Log_Pos: 879029246
? ? ? ? ? ? ?Relay_Log_File: memcached-relay-bin.000002
? ? ? ? ? ? ? Relay_Log_Pos: 1336369