记一次 : canal-deployer 报错: Received error packet: errno = 1236, sqlstate = HY000 errmsg = Could not find first log file name in binary log index file

懒得看文字的直看倒数后两行

完整报错

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:102) ~[canal.parse-1.1.5.jar:na]
        at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:176) ~[canal.parse-1.1.5.jar:na]
        at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$1.run(AbstractEventParser.java:276) ~[canal.parse-1.1.5.jar:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]

差错思路

  • 1.报错信息看来是找不到 binlog 日志, 于是第一时间去查一下binlog 日志的情况
  • 2.然后复制 里面的 File : szc242013.004641 和 Position 到 instance 管理里面的配置文件中,如下
canal.instance.master.journal.name=szc242013.004641
canal.instance.master.position=377719481AA

  • 3.保存重启. 没有解决.去服务器查看配置文件
cd /usr/local/canal-deployer/conf/你的出问题的instance库名
less meta.dat

meta.dat内容为:

{"clientDatas":[{"clientIdentity":{"clientId":1001,"destination":"ky_settlement","filter":""},"cursor":{"identity":{"slaveId":-1,"sourceAddress":{"address":"10.ppp.ppp.ppp","port":ppp}},"postion":{"gtid":"","included":false,"journalName":"szc242013.000459","position":693561003,"serverId":2500113406,"timestamp":1626846400000}}}],"destination":"库名"}

其中 journalName、position的值 和数据库中查到的是不一样的. 那问题就出在这里了.

  • 两种方法.
    • instance配置删掉重建一个,名字修改一下,配置一模一样. 我用的这种, 问题解决.
    • 修改meta.dat内容 ,重启instance

以上都不行,可以尝试重置zk里面的信息。

./zkCli.sh -server 127.0.0.1:2181 deleteall /canal/otter/canal/destinations
posted @ 2022-12-29 17:58  博文43231  阅读(1339)  评论(0编辑  收藏  举报