Error in Log_event::read_log_event(): 'Event too small', data_len: 0, event_type: 0

MySQL主從複製報錯以下:java

2018-04-11 09:11:16 2400 [Note] Slave SQL thread initialized, starting replication in log 'binlog.000042' at position 1934531, relay log '/mysql/data/relay_bin.000053' position: 1934691
2018-04-11 09:11:16 2400 [ERROR] Error in Log_event::read_log_event(): 'Event too small', data_len: 0, event_type: 0
2018-04-11 09:11:16 2400 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
2018-04-11 09:11:16 2400 [ERROR] Slave SQL: 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. Error_code: 1594
2018-04-11 09:11:16 2400 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000042' position 1934531mysql

三臺虛擬機作的MHA主從複製,因爲常常開關機致使會出現此類錯誤。如上所示:sql

We stopped at log 'binlog.000042' position 1934531

解決辦法是直接在slave上執行以下命令:網絡

stop slave;
reset slave all;
change master to master_host='192.168.20.70',master_user='rep',master_password='rep',master_log_file='binlog.000042',master_log_pos=1934531;
start slave;

就按報錯所示的binlog和pos進行主從複製的重置,以後就能夠正常運行。ui

出現此報錯可能的緣由:this

如error日誌中所顯示的緣由,多是主庫的binlog損壞或者從庫的relaylog損壞,或者網絡問題,致使主從複製異常中斷,此時只要從新執行change master便可。可是極端狀況下由主從各自實例恢復形成的不一致沒法進行恢復,只能重作主從。spa

相關文章
相關標籤/搜索