你好,我使用10.1.22-MariaDB和1.1.1版本canal,启动后报如下错误
2018-11-01 09:40:42.663 [destination = cloud , address = /192.168.1.21:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - prepare to find start position just last position {"identity":{"slaveId":-1,"sourceAddress":{"address":"192.168.1.21","port":3306}},"postion":{"gtid":"","included":false,"journalName":"mysql-bin.000607Æ\u009E´U","position":91598031,"serverId":1,"timestamp":1541028888000}} 2018-11-01 09:40:42.674 [destination = cloud , address = /192.168.1.21:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - find start position : EntryPosition[included=false,journalName=mysql-bin.000607Æ´U,position=91598031,serverId=1,gtid=,timestamp=1541028888000] 2018-11-01 09:40:42.690 [destination = cloud , address = /192.168.1.21:3306 , EventParser] ERROR c.a.o.canal.parse.inbound.mysql.dbsync.DirectLogFetcher - I/O error while reading from client socket 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.1.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:216) [canal.parse-1.1.1.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:252) [canal.parse-1.1.1.jar:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161] 2018-11-01 09:40:42.691 [destination = cloud , address = /192.168.1.21:3306 , EventParser] ERROR c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - dump address /192.168.1.21:3306 has an error, retrying. caused by 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.1.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:216) ~[canal.parse-1.1.1.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:252) ~[canal.parse-1.1.1.jar:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161] 2018-11-01 09:40:42.692 [destination = cloud , address = /192.168.1.21:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:cloud[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) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:216) at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:252) at java.lang.Thread.run(Thread.java:748) ] 看到是journalName有乱码,请问怎么解决
我改了EntryPosition类 加了个解析方法
public EntryPosition(String journalName, Long position, Long timestamp){ super(timestamp); this.journalName = filterLogFileName(journalName); this.position = position; }
public EntryPosition(String journalName, Long position, Long timestamp, Long serverId){ this(journalName, position, timestamp); this.serverId = serverId; }
public String filterLogFileName(String logfileName) { Pattern p = Pattern.compile("(mysql-bin\.[0-9]{6})."); Matcher m = p.matcher(logfileName); while(m.find()){ if(m.groupCount() >= 1) { return m.group(1); } } return logfileName; }
public String getJournalName() { return filterLogFileName(journalName); }
public void setJournalName(String journalName) { this.journalName = filterLogFileName(journalName); }
然后好使了
原提问者GitHub用户haopangxu
可以试一下我的改法.
主要原因: mariadb在处理checksum行为上和mysql有点不太一致,针对rotate_event这个binlog对象,mariadb会执行checksum,而mysql不会,需要有特殊判断处理
原回答者GitHub用户agapple
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。