欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-07-04 21:00:02
MySQL主从复制报错如下: 2018-04-11 09:11:16 2400 [Note] Slave SQL thread initialized, starting replication in log 'binlog.000042' at position 1934531, relay lo ......

MySQL主从复制报错如下:

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 1934531

三台虚拟机做的MHA主从复制,由于经常开关机导致会出现此类错误。如上所示:

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进行主从复制的重置,之后就可以正常运行。

出现此报错可能的原因:

如error日志中所显示的原因,可能是主库的binlog损坏或者从库的relaylog损坏,或者网络问题,导致主从复制异常中断,此时只要重新执行change master即可。但是极端情况下由主从各自实例恢复造成的不一致无法进行恢复,只能重做主从。