Canal连接MySQL失败经典错误

重装MySQL后,Canal连接不上

查看日志:

// 去到canal安装文件目录执行命令
tail -f -n 50 logs/example/example.log

错误代码:

2021-05-17 22:30:11.612 [destination = example , address = /127.0.0.1:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[java.io.IOException: Received error packet: errno = 1236, sqlstate = HY000 errmsg = binlog truncated in the middle of event; consider out of disk space on master; the first event 'mysql-bin.000003' at 1731, the last event read from './mysql-bin.000003' at 123, the last byte read from './mysql-bin.000003' at 1750.
        at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetcher.fetch(DirectLogFetcher.java:102)
        at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:235)
        at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:265)
        at java.lang.Thread.run(Thread.java:748)

错误原因:

canal会记录binlog的位置保存在canal实例的meta.dat文件中,重装sql后,canal从meta.bat读取之前的binlog信息,没有重新读取加载配置
[root@baiduyun cannal]# ls
bin  canal.deployer-1.1.4.tar.gz  conf  lib  logs // 进入conf配置文件目录
[root@baiduyun cannal]# cd conf
[root@baiduyun conf]# ls
canal_local.properties  canal.properties  example  logback.xml  metrics  spring  // 此处的example就是当前的canal实例的配置文件目录(实例名字)
[root@baiduyun conf]# cd example/
[root@baiduyun example]# ls
h2.mv.db  instance.properties  meta.bat   // 这里的meta.dat就是记录binlog信息的文件
[root@baiduyun example]# 

解决方案:

停止canal,把实例的meta.bat删掉再重启即可
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值