开发者社区> 问答> 正文

10.1.22-MariaDB版本数据库 journalName乱码

你好,我使用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

展开
收起
Java工程师 2023-05-08 17:56:30 67 0
1 条回答
写回答
取消 提交回答
  • 可以试一下我的改法.

    主要原因: mariadb在处理checksum行为上和mysql有点不太一致,针对rotate_event这个binlog对象,mariadb会执行checksum,而mysql不会,需要有特殊判断处理

    原回答者GitHub用户agapple

    2023-05-09 18:49:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
2022 DTCC-阿里云一站式数据库上云最佳实践 立即下载
云时代的数据库技术趋势 立即下载
超大型金融机构国产数据库全面迁移成功实践 立即下载

相关镜像