Mysql 主从碰到的一个故障

作者 : 开心源码 本文共1824个字,预计阅读时间需要5分钟 发布时间: 2022-05-12 共262人阅读

今天因为 slave 机异常掉电导致主从同步出现异常

在 slave mysql 上查看 slave 状态:

show slave status\G

发现 IO 线程正常,但是 SQL 线程 NO,错误如下:

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.

查看 mysql 错误日志:

160817 18:01:14 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 1011, event_type: 23
160817 18:01:14 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
160817 18:01:14 [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
160817 18:01:14 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000022' position 1068142925

We stopped at log ‘mysql-bin.000022’ position 1068142925

重新定位 master binlog

stop slave;
change master to master_host='xx.xx.xx.xx',master_user='xxxxx',master_password='xxxx', master_log_file='mysql-bin.000022',master_log_pos=1068142925;
start slave;
show slave status\G

SQL Thread 正常了。

应该是异常掉电导致 relay-log 错误导致的。

说明
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » Mysql 主从碰到的一个故障

发表回复