zoukankan      html  css  js  c++  java
  • Error in Log_event::read_log_event(): 'Event too small', data_len: 0, event_type: 0

    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即可。但是极端情况下由主从各自实例恢复造成的不一致无法进行恢复,只能重做主从。

  • 相关阅读:
    linux项目部署学习(1) pyhton3的虚拟环境virtualenv和virtualenvwrapper详解
    linux下pip查看安装包的路径、和指定安装目录
    python+selenium实现长截图
    selenium设置chrome浏览器保持登录方式两种options和cookie
    linux中离线安装django
    理解 bashrc 和 profile
    Django部署阿里云服务时候报错:SQLite 3.8.3 or later is required (found 3.7.17)
    Django的django-admin工具详解
    Yum Install --Downloadonly 离线下载依赖包研究
    分治法求n个点中的最近距离
  • 原文地址:https://www.cnblogs.com/leohahah/p/8795016.html
Copyright © 2011-2022 走看看