mysql8.0.14 canal1.1.3
希望读取旧数据,所以在canal中设置mysql的binlog位置信息 在canal的conf/example/instance.properties中设置binlog开始位置
canal.instance.master.address=192.183.3.109:3306 canal.instance.master.journal.name=mysql-bin.000001 canal.instance.master.position=1
mysql8中输入show master status; 返回
File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | mysql-bin.000054 | 37254 | | | | +------------------+----------+--------------+------------------+---------------
当我不设置position info的时候,是正常的,如果设置了position info,会报以下异常
2019-04-11 16:20:03.057 [destination = example , address = /192.183.3.109: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.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.seek(MysqlConnection.java:144) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findAsPerTimestampInSpecificLogFile(MysqlEventParser.java:743) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findPositionWithMasterIdAndTimestamp(MysqlEventParser.java:407) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPositionInternal(MysqlEventParser.java:452) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPosition(MysqlEventParser.java:366) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:186) [canal.parse-1.1.3.jar:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201] 2019-04-11 16:20:03.057 [destination = example , address = /192.183.3.109:3306 , EventParser] ERROR c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ERROR ## findAsPerTimestampInSpecificLogFile has an error 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.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.seek(MysqlConnection.java:144) ~[canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findAsPerTimestampInSpecificLogFile(MysqlEventParser.java:743) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findPositionWithMasterIdAndTimestamp(MysqlEventParser.java:407) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPositionInternal(MysqlEventParser.java:452) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPosition(MysqlEventParser.java:366) [canal.parse-1.1.3.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:186) [canal.parse-1.1.3.jar:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201] 2019-04-11 16:20:03.058 [destination = example , address = /192.183.3.109:3306 , EventParser] ERROR c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - dump address /192.183.3.109:3306 has an error, retrying. caused by com.alibaba.otter.canal.parse.exception.CanalParseException: [fixed timestamp] can't found begin/commit position before with fixed positionmysql-bin.000001:1 2019-04-11 16:20:03.058 [destination = example , address = /192.183.3.109:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[com.alibaba.otter.canal.parse.exception.CanalParseException: [fixed timestamp] can't found begin/commit position before with fixed positionmysql-bin.000001:1
原提问者GitHub用户windyyong
根据报错信息显示,canal在读取历史binlog时,在索引文件中无法获取第一个binlog文件名,所以提示了该异常信息。
可能的原因是在mysql实例中没有启用binlog或者没有生成任何binlog,或者配置文件中master.position值设置错误导致找不到第一个binlog。建议检查以下几个问题:
检查MySQL是否启用了binlog 可以执行SHOW BINARY LOGS;查看当前的binlog状态,如果没有binlog则需要先启用binlog。
检查MySQL binlog文件路径和文件名 确认MySQL的binlog日志文件路径和文件名是否正确,找到对应的第一个binlog文件。
确认canal中的master.position的设置是否正确 可以使用SHOW MASTER STATUS\G命令来获取当前binlog的名称和位置信息,然后手动设置canal中的master.position参数。
以上问题解决之后,重新启动canal服务即可检查是否正常读取历史binlog数据。另外,在canal配置文件中,可以增加以下参数用于控制是否读取历史binlog:
canal.instance.includeBinlogPosition=true
如果设置为false,则只会读取自启动时间之后的binlog数据。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。