IT技术博客大学习 共学习 共进步
全部 移动开发 后端 数据库 AI 算法 安全 DevOps 前端 设计 开发者

主从同步失败,报错 1594

扶凯 2012-03-11 22:19:14 累计浏览 2,723 次
本机暂存
mysql 的主从同步挂了,从日志中报的错如下:
120309 18:39:23 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000004' at position 2207467, relay log './mysqld-relay-bin.000011' position: 2207613
120309 18:39:23 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 166, event_type: 2
120309 18:39:23 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
120309 18:39:23 [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
120309 18:39:23 [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.000004' position 2207467

分析主要原因是因为断电,所以引起读 binlog 出错,根据网上一些资料,修复的方法是:

1
2
3
4
5
6
7
8
stop slave;
change master to
 master_host='192.168.1.251',
 master_user='repl',
 master_password='password',
 master_log_file='mysql-bin.000004',
 master_log_pos=2207467;
start slave;

这样就修复 OK 了.上面的同步文件和同步点 pos 是日志中报错上次记录的位置.

同分类推荐文章

  1. 使用deepseek进行Oracle恢复,引起重大故障 (2026-06-22 10:56:00)
  2. 接手一个只差临门一脚的数据库恢复 (2026-06-18 00:13:09)
  3. 我做了一个 AI 版的 StarRocks 升级风险扫描工具,直接帮我定位到一个风险 (2026-06-15 01:00:00)

查看更多 数据库 文章 →

建议继续学习

  1. 用Hyer来进行网站的抓取 (累计阅读 158,252)
  2. MySQL数据库在实际应用一些方面的介绍 (累计阅读 36,399)
  3. WordPress插件开发 -- 在插件使用数据库存储数据 (累计阅读 29,164)
  4. Mysql监控指南 (累计阅读 21,351)
  5. 由浅入深探究mysql索引结构原理、性能分析与优化 (累计阅读 16,523)
  6. 在Apache2.2.XX下安装Mod-myvhost模块 (累计阅读 13,058)
  7. 15个最好的免费开源电子商务平台 (累计阅读 12,541)
  8. 浅谈MySQL索引背后的数据结构及算法 (累计阅读 11,908)
  9. 整理了一份招PHP高级工程师的面试题 (累计阅读 11,709)
  10. 深入浅出INNODB MVCC机制与原理 (累计阅读 9,693)