1594 database data_error ai_generated true

错误:中继日志读取失败:无法解析中继日志事件。从服务器已停止。Last_IO_Error:读取中继日志事件错误:中继日志读取失败

ERROR: Relay log read failure: could not parse relay log event. The slave is stopped. Last_IO_Error: error reading relay log event: relay log read failure

ID: database/mysql-slow-replica-lag-bytes-behind

其他格式: JSON · Markdown 中文 · English
75%修复率
85%置信度
1证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
MySQL 5.7 active
MySQL 8.0 active
MySQL 8.4 active

根因分析

MySQL 中继日志损坏或被截断,通常是由于磁盘 I/O 错误或复制过程中服务器意外关闭。

English

MySQL relay log is corrupted or truncated, often due to disk I/O errors or abrupt server shutdown during replication.

generic

官方文档

https://dev.mysql.com/doc/refman/8.0/en/replication-options-replica.html

解决方案

  1. STOP SLAVE; RESET SLAVE; CHANGE MASTER TO ...; START SLAVE; (reinitialize replication from scratch using SHOW SLAVE STATUS to get the correct master log file and position, or use GTID if enabled)
  2. STOP SLAVE; SET GLOBAL relay_log_purge=0; START SLAVE; (if the error is transient, this may skip the bad event but risks data inconsistency)

无效尝试

常见但无效的做法:

  1. Restart the MySQL replica service without fixing the relay log 95% 失败

    The corrupted relay log persists and will be re-read, causing the same error immediately.

  2. Manually delete relay log files and restart replication without resetting 80% 失败

    MySQL still expects the relay log index to reference the deleted files, leading to further errors.