mysqlbinlog Error in Log_event 原因及其解决

话说昨天配置好了 mysql 的 replication,今天到 slave 上 show slave status 却发现出错了,错误日志里面这么说的:

100921 21:49:10 [ERROR] Error in Log_event::read_log_event(): ‘Found invalid event in binary log’, data_len: 80, event_type: 19
100921 21:49:10 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
100921 21:49:10 [ERROR] Slave: 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: 0
100921 21:49:10 [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.000293’ position 616316942

到 Google 搜索了一下这个问题,发现貌似是 mysqlbinlog 这个程序的版本问题,仔细一看我的 master 跑的是 mysql-server 5.1,mysqlbinlog 版本是 3.3,而 slave 的 mysql-server 是 5.0,mysqlbinlog 是 3.2 版,于是备份好数据尝试升级:

pkg_delete -f mysql\*
cd /usr/ports/mysql51-server
make install clean

貌似没出问题,然后 skip-slave-start 启动 mysql-server,恢复断点:

mysql> CHANGE MASTER TO MASTER_LOG_FILE=’mysql-bin.000293′ , MASTER_LOG_POS=616316942;
mysql> slave start;
mysql> show slave status;

看到 Slave_IO_Running 和 Slave_SQL_Running 都是 YES 应该就恢复 replication 了,对比一下两边的数据,应该是正常的。至于这个错误到底是不是 mysqlbinlog 版本的问题,只能观察几天看看了。

UPDATE:升级后,跑了5天没有再出现类似问题,不过 mysql 升级后还是带来了一些连锁反应,见这里

This entry was posted in 我的慵懒生活, 电脑相关 and tagged , . Bookmark the permalink.

2 Responses to mysqlbinlog Error in Log_event 原因及其解决

  1. Pingback: mysql 升级后的连锁反应 | gkp's post

  2. Pingback: mysql 升级后的连锁反应

Leave a Reply

Your email address will not be published.