跳到主要内容

MySQL 源端找不到 binlog 文件

现象

MySQL 源端同步任务中断,日志中出现

java.io.IOException: Received error packet: errno = 1236, sqlstate = HY000 errmsg = Could not find first log file name in binary log index file

排查

原因

  • MySQL binlog 文件被清理,任务未能及时消费 binlog 文件
    • 任务异常导致任务无法继续消费位点
    • 任务消费过慢,binlog 清理过快,任务消费过慢可参考性能调优文章

解决

  1. 任务详情页面查看当前任务正在消费的 binlog 文件

  2. 检查当前消费的 binlog 文件是否存在

    参考命令:show binary logs

  3. 回溯或者清除位点(binlog 文件不存在)

  4. 数据校验和订正

  5. 调整 MySQL binlog 文件保留时间(推荐设置 24 小时及以上)