当前位置: 代码迷 >> 综合 >> canal Could not find first log file name in binary log index file
  详细解决方案

canal Could not find first log file name in binary log index file

热度:75   发布时间:2023-09-14 14:59:09.0

错误描述:

14:50:36.090 [destination = example , address = / , EventParser] 
ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[java.io.IOException:
Received error packet: errno = 1236, sqlstate = HY000 
errmsg = Could not find first log file name in binary log index file  at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetcher.fetch(DirectLogFetcher.java:95)  at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:113)  at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:209)  at java.lang.Thread.run(Thread.java:745)

mysql binlog 被移走了 /var/lib/mysql
所以报这个错

解决办法

查看主库状态,主要查看日志文件和位置:
show master status;
解决方法: 编辑canal/conf/example/meta.dat 重新指定链接信息,然后重起canal服务。
meta.data 内容是个json串,大概如下:

{"clientDatas":[{"clientIdentity":{"clientId":1001,"destination":"example","filter":""}, 
"cursor":{"identity":{"slaveId":-1,"sourceAddress":{"address":"10.10.161.84","port":3306}},
"postion":{"included":false,"journalName":"mysql-bin.000033","position":5988,"timestamp":1429621093000}}}],
"destination":"example"
}

我只修改了其中几项:
clientId 可以参考:canal/logs/example/meta.log
address:主库ip
port:主库端口
journalName : binlog名称。
position:开始同步的位置
timestamp : 延迟的时间(写0会从journalName开头开始同步)。
destination : 实例名(默认应该和当前目录名一致)
注: 实际运行发现,如果指定参数有差异,canal会从journalName的起始位置开始同步。

  相关解决方案