环境:
Fedora 21 docker 1.8.1 docker mysql 5.5.45
mysql配置:
[mysqld] server-id=1042776 log_bin=mysql-bin log_error=mysql-bin.err binlog-format=ROW
canal配置:
[snowwolf@snowwolf-dev canal]$ cat conf/example/instance.properties #################################################
canal.instance.mysql.slaveId = 1234
canal.instance.master.address = 127.0.0.1:33306 canal.instance.master.journal.name = canal.instance.master.position = canal.instance.master.timestamp =
#canal.instance.standby.address = #canal.instance.standby.journal.name = #canal.instance.standby.position = #canal.instance.standby.timestamp =
canal.instance.dbUsername = canal canal.instance.dbPassword = canal canal.instance.defaultDatabaseName = dbroute_01 canal.instance.connectionCharset = UTF-8
canal.instance.filter.regex = .\..
canal.instance.filter.black.regex =
#################################################
启动参数:
docker run --name dbrouter-mysql-dev -p 33306:3306 -v /etc/mysql/conf.d:/etc/mysql/conf.d -v /var/lib/docker-mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xxx -d mysql:5.5
日志:
2015-09-08 21:11:34.687 [destination = example , address = /127.0.0.1:33306 , EventParser] WARN c.a.otter.canal.parse.inbound.mysql.MysqlEventParser - prepare to find start position by switch ::1441612069000 2015-09-08 21:11:34.701 [destination = example , address = /127.0.0.1:33306 , EventParser] WARN c.a.otter.canal.parse.inbound.mysql.MysqlEventParser - Didn't find the corresponding binlog files from mysql-bin.000001 to mysql-bin.000003 2015-09-08 21:11:34.701 [destination = example , address = /127.0.0.1:33306 , EventParser] ERROR c.a.otter.canal.parse.inbound.mysql.MysqlEventParser - dump address /127.0.0.1:33306 has an error, retrying. caused by com.alibaba.otter.canal.parse.exception.CanalParseException: can't find start position for example 2015-09-08 21:11:34.702 [destination = example , address = /127.0.0.1:33306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[com.alibaba.otter.canal.parse.exception.CanalParseException: can't find start position for example ]
使用mysqlbinlog可以解析
[root@snowwolf-dev ~]# mysqlbinlog -h127.0.0.1 -P33306 -ucanal -pcanal --read-from-remote-server -v --start-position=296 -d dbroute_01 mysql-bin.000003 /!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1/; /!40019 SET @@session.max_insert_delayed_threads=0/; /!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0/; DELIMITER /!/;
#150908 20:29:44 server id 1042776 end_log_pos 0 Start: binlog v 4, server v 5.5.45-log created 150908 20:29:44 BINLOG ' uNTuVQ9Y6Q8AZwAAAAAAAAAAAAQANS41LjQ1LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== '/!/;
#150908 20:33:05 server id 1042776 end_log_pos 431 Write_rows: table id 3979 flags: STMT_END_F
BINLOG ' gdXuVRdY6Q8AhwAAAK8BAAAAAIsPAAAAAAEAGP///0DSPgMAAACyyO5VssjuVQEAAAAKMTIzNDU2 Nzg5MgwrMTM4MTAwMDEwMDIJAHRlc3R1c2VyMyBlMTBhZGMzOTQ5YmE1OWFiYmU1NmUwNTdmMjBm ODgzZQGyyO5VAQEABGFiY2QAAAAA '/!/;
#150908 20:33:05 server id 1042776 end_log_pos 458 Xid = 914 COMMIT/!/;
#150908 20:57:33 server id 1042776 end_log_pos 532 Query thread_id=515 exec_time=0 error_code=0 SET TIMESTAMP=1441717053/!/; SET @@session.pseudo_thread_id=515/!/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/!/; SET @@session.sql_mode=0/!/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/!/; /!\C utf8mb4 //!/; SET @@session.character_set_client=45,@@session.collation_connection=224,@@session.collation_server=8/!/; SET @@session.lc_time_names=0/!/; SET @@session.collation_database=DEFAULT/!/; BEGIN /!/;
#150908 20:57:33 server id 1042776 end_log_pos 639 Table_map: dbroute_01
.uc_member_000
mapped to number 3979 #150908 20:57:33 server id 1042776 end_log_pos 774 Delete_rows: table id 3979 flags: STMT_END_F
BINLOG ' PdvuVRNY6Q8AawAAAH8CAAAAAIsPAAAAAAEACmRicm91dGVfMDEADXVjX21lbWJlcl8wMDAAGAMH BwMPDw8PDwEBBw8BDwECAQ8PDw8PBxg8ADwAPAAsAZYAlgDAADwAeAA8ADwAHgDg9z4= PdvuVRlY6Q8AhwAAAAYDAAAAAIsPAAAAAAEAGP///0DSPgMAAACyyO5VssjuVQEAAAAKMTIzNDU2 Nzg5MgwrMTM4MTAwMDEwMDIJAHRlc3R1c2VyMyBlMTBhZGMzOTQ5YmE1OWFiYmU1NmUwNTdmMjBm ODgzZQGyyO5VAQEABGFiY2QAAAAA '/!/;
dbroute_01
.uc_member_000
#150908 20:57:33 server id 1042776 end_log_pos 801 Xid = 3451 COMMIT/!/; DELIMITER ;
ROLLBACK /* added by mysqlbinlog /; /!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0/;
原提问者GitHub用户snowwolf007cn
prepare to find start position by switch ::1441612069000 基于时间戳定位位点,找不到比这时间小的binlog. 建议. 删除历史位点,重新订阅
原回答者GitHub用户agapple
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。