天天看點

canal問題排查及解決思路

問題一:

ERROR c.a.otter.canal.parse.inbound.mysql.MysqlEventParser - dump address /192.168.1.50:3306 has an error, retrying. caused by

com.alibaba.otter.canal.parse.exception.CanalParseException: can't find start position for example

原因:meta.dat 中儲存的位點資訊和資料庫的位點資訊不一緻;導緻canal抓取不到資料庫的動作;

解決方案:删除meta.dat删除,再重新開機canal,問題解決;

叢集操作:進入canal對應的zookeeper叢集下,删除節點/otter/canal/destinations/xxxxx/1001/cursor ;重新開機canal即可恢複;

問題二:

java.lang.OutOfMemoryError: Java heap space

canal消費端挂了太久,在zk對應conf下節點的

/otter/canal/destinations/test_db/1001/cursor 位點資訊是很早以前,導緻重新開機canal時,從很早以前的位點開始消費,導緻canal伺服器記憶體爆掉

監聽資料庫變更,隻有TransactionBegin/TransactionEnd,沒有拿到資料的EventType;

原因可能是canal.instance.filter.black.regex=.*\\..*導緻,改canal.instance.filter.black.regex=再重新開機試試;

問題三:

ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:fdyb_db[com.alibaba.otter.canal.parse.exception.CanalParseException: com.alibaba.otter.canal.parse.exception.CanalParseException: parse row data failed.

Caused by: com.alibaba.otter.canal.parse.exception.CanalParseException: parse row data failed.

Caused by: com.alibaba.otter.canal.parse.exception.CanalParseException: com.google.common.collect.ComputationException: com.alibaba.otter.canal.parse.exception.CanalParseException: fetch failed by table meta:​

​mysql​

​.​

​pds_4490277​

Caused by: com.google.common.collect.ComputationException: com.alibaba.otter.canal.parse.exception.CanalParseException: fetch failed by table meta:​

​mysql​

​.​

​pds_4490277​

Caused by: com.alibaba.otter.canal.parse.exception.CanalParseException: fetch failed by table meta:​

​mysql​

​.​

​pds_4490277​

Caused by: java.io.IOException: ErrorPacket [errorNumber=1142, fieldCount=-1, message=SELECT command denied to user 'cy_canal'@'11.217.0.224' for table 'pds_4490277', sqlState=42000, sqlStateMarker=#]

with command: desc ​

​mysql​

​.​

​pds_4490277​

分析:mysql系統表權限較高,canal讀該表的binlog失敗,位點無法移動

解決:将配置項中黑名單加上mysql下的所有表:canal.instance.filter.black.regex = mysql\\..* ,修改後canal叢集不需要重新開機即可恢複;

其它注意點:檢查下CanalConnector是否調用subscribe(filter)方法;有的話,filter需要和instance.properties的canal.instance.filter.regex一緻,否則subscribe的filter會覆寫instance的配置,如果subscribe的filter是.\\..,那麼相當于你消費了所有的更新資料。

問題四:

現象:資料庫修改後,canal應用感覺不到binlog,資料無法正常消費處理;

繼續閱讀