This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
问1:INSERT/UPDATE/DELETE被解析为Query或DDL语句?
答1: 出现这类情况主要原因为收到的binlog就为Query事件,比如:
- binlog格式为非row模式,通过show variables like 'binlog_format'可以查看. 针对statement/mixed模式,DML语句都会是以SQL语句存在
- mysql5.6+之后,在binlog为row模式下,针对DML语句通过一个开关(binlog-rows-query-log-events=true, show variables里也可以看到该变量),记录DML的原始SQL,对应binlog事件为RowsQueryLogEvent,同时也有对应的row记录. ps. canal可以通过properties设置来过滤:canal.instance.filter.query.dml = true
问2:设置了数据表的过滤条件,但貌似没有生效?
答2:
- 首先看文档AdminGuide,了解canal.instance.filter.regex的书写格式
mysql 数据解析关注的表,Perl正则表达式. 多个正则之间以逗号(,)分隔,转义符需要双斜杠(\\) 常见例子: 1. 所有表:.* or .*\\..* 2. canal schema下所有表: canal\\..* 3. canal下的以canal打头的表:canal\\.canal.* 4. canal schema下的一张表:canal.test1 5. 多个规则组合使用:canal\\..*,mysql.test1,mysql.test2 (逗号分隔) - 检查binlog格式,过滤条件只针对row模式的数据有效(ps. mixed/statement因为不解析sql,所以无法准确提取tableName进行过滤)
- 检查下CanalConnector是否调用subscribe(filter)方法;有的话,filter需要和instance.properties的canal.instance.filter.regex一致,否则subscribe的filter会覆盖instance的配置,如果subscribe的filter是.*\..*,那么相当于你消费了所有的更新数据 【特别注意】
- canal 1.1.3+版本之后,会在日志里记录最后使用的filter条件,可以对比使用的filter看看是否和自己期望的是一致,如果不一致检查一下第3步
c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$ c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table black filter : - 检查一下历史的issue列表,很有可能你的提问别人已经遇到过并解决了,比如表达式不对,特别是双斜杠的问题
问3:canal是否支持aliyun rds的binlog订阅?
答3: 参考issue:https://github.com/alibaba/canal/issues/727
问4:canal的整体性能怎么样?
答4:
- 参考issue: https://github.com/alibaba/canal/issues/726
- 参考性能测试文档:https://github.com/alibaba/canal/wiki/Performance
问5: 出现batchId:73 is not the firstly:72 或 clientId:1001 batchId:50560 is not exist , please check
答5:
- 第一个原因是client在ack的问题,前两个异常是client没有按照顺序ack对应的batchId
- 最后一个是ack的batchId在服务端被清理了ps. 服务端发生清理只有两个原因:
- client发起过一次rollback
- server端发生过一次instance的重启,比如scan=true时发现文件变化自动restart了
问6:Received error packet: errno = 1236, sqlstate = HY000 errmsg = Could not find first log file name in binary log index file
答6: 出现dump异常时,建议把errno/errmsg到google上搜索一下,这个异常是mysql标准返回的,代表对应的binlog位点在mysql里不存在,应该是被mysql server清理掉了,解决办法:重置一下canal订阅位点
Contents 目录
- Home
- Introduction / 简介
- Quick Start
- Client Guide
- Canal Admin
- Canal Performance
- AdminGuide
- DevGuide
- BinlogChange(Mysql5.6)
- BinlogChange(MariaDB)
- BinlogChange(MySQL8)
- TableMetaTSDB
- ReleaseNotes
- Download
- FAQ / 常见问题解答