开发者社区> 问答> 正文

无法读取Binlog

环境:

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 #################################################

mysql serverId

canal.instance.mysql.slaveId = 1234

position info

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 =

username/password

canal.instance.dbUsername = canal canal.instance.dbPassword = canal canal.instance.defaultDatabaseName = dbroute_01 canal.instance.connectionCharset = UTF-8

table regex

canal.instance.filter.regex = .\..

table black 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 /!/;

at 296

#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== '/!/;

at 296

#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 '/!/;

Row event for unknown table #3979# at 431

#150908 20:33:05 server id 1042776 end_log_pos 458 Xid = 914 COMMIT/!/;

at 458

#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 /!/;

at 532

at 639

#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 '/!/;

DELETE FROM dbroute_01.uc_member_000

WHERE

@1=3

@2=1441712306

@3=1441712306

@4=1

@5='1234567892'

@6='+13810001002'

@7=NULL

@8='testuser3'

@9='e10adc3949ba59abbe56e057f20f883e'

@10=NULL

@11=1

@12=1441712306

@13=NULL

@14=1

@15=NULL

@16=NULL

@17=1

@18=NULL

@19=NULL

@20=NULL

@21=NULL

@22=NULL

@23='abcd'

@24=0

at 774

#150908 20:57:33 server id 1042776 end_log_pos 801 Xid = 3451 COMMIT/!/; DELIMITER ;

End of log file

ROLLBACK /* added by mysqlbinlog /; /!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0/;

原提问者GitHub用户snowwolf007cn

展开
收起
绿子直子 2023-05-09 16:06:19 141 0
1 条回答
写回答
取消 提交回答
  • prepare to find start position by switch ::1441612069000 基于时间戳定位位点,找不到比这时间小的binlog. 建议. 删除历史位点,重新订阅

    原回答者GitHub用户agapple

    2023-05-10 11:05:48
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载