启动canal一直报错:Table 'xx.xx' doesn't exist

原创 2019-08-21 10:47 阅读(2522)次

在使用cancal异构数据库的时候,只是根据官方配置单机版启动一直报错,如下:

2019-08-21 09:18:13.007 [destination = example , address = /127.0.0.1:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[com.alibaba.otter.canal.parse.exception.CanalParseException: java.io.IOException: ErrorPacket [errorNumber=1146, fieldCount=-1, message=Table 'personnel.common_staff_customerinfo' doesn't exist, sqlState=42S02, sqlStateMarker=#]
 with command: show create table `personnel`.`common_area_list`;show create table `personnel`.`common_company`;show create table `personnel`.`common_customer`;show create table `personnel`.`common_customerinfo`;show create table `personnel`.`common_department`;show create table `personnel`.`common_dict`;show create table `personnel`.`common_staff`;show create table `personnel`.`common_staff_authentic`;show create table `personnel`.`common_staff_black_list`;show create table `personnel`.`common_staff_certificate`;show create table `personnel`.`common_staff_change`;show create table `personnel`.`common_staff_customer`;show create table `personnel`.`common_staff_customerInfo`;show create table `personnel`.`common_staff_invite_record`;show create table `personnel`.`common_staff_station`;show create table `personnel`.`common_station`;show create table `personnel`.`common_store_authentic`;
Caused by: java.io.IOException: ErrorPacket [errorNumber=1146, fieldCount=-1, message=Table 'personnel.common_staff_customerinfo' doesn't exist, sqlState=42S02, sqlStateMarker=#]
 with command: show create table `personnel`.`common_area_list`;show create table `personnel`.`common_company`;show create table `personnel`.`common_customer`;show create table `personnel`.`common_customerinfo`;show create table `personnel`.`common_department`;show create table `personnel`.`common_dict`;show create table `personnel`.`common_staff`;show create table `personnel`.`common_staff_authentic`;show create table `personnel`.`common_staff_black_list`;show create table `personnel`.`common_staff_certificate`;show create table `personnel`.`common_staff_change`;show create table `personnel`.`common_staff_customer`;show create table `personnel`.`common_staff_customerInfo`;show create table `personnel`.`common_staff_invite_record`;show create table `personnel`.`common_staff_station`;show create table `personnel`.`common_station`;show create table `personnel`.`common_store_authentic`;
	at com.alibaba.otter.canal.parse.driver.mysql.MysqlQueryExecutor.queryMulti(MysqlQueryExecutor.java:109)
	at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.queryMulti(MysqlConnection.java:111)
	at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta.dumpTableMeta(DatabaseTableMeta.java:230)
	at com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta.rollback(DatabaseTableMeta.java:180)
	at com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.processTableMeta(AbstractMysqlEventParser.java:106)
	at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:192)
	at java.lang.Thread.run(Unknown Source)
]
上面的错误显示show create table命令找不到表,可我的表是存在的,一直不明白是什么问题,解决了很久,第二天继续查看这个问题,也检查了复制用户的权限,创建复制用户的语句如下:
CREATE USER `report_copy_user`@`%` IDENTIFIED BY 'xxxx@#';
GRANT Select, Replication Client, Replication Slave ON *.* TO `report_copy_user`@`%`;
都没有问题,不过对照了一下网上人家的,少了执行这句:
FLUSH PRIVILEGES;

执行了一下,重启canal,居然可以了,后来检查了下数据库,发现数据库my.cnf配置了skip-grant-tables跳过认证,所以要先处理掉skip-grant-tables跳过认证的问题。

另外,这个问题也可能是主库没有设置不区分大小写造成的。

lower_case_table_names=1 #不区分大小写

这个问题最终解决的问题可能与上面无关,我后面还是报这个错。。。

后面才发现,这张表Table 'personnel.common_staff_customerinfo' doesn't exist是真的不存在,问了下同事,他说他很早就删除了。为什么工具能看到它呢,好奇怪。。问题的根源终于找到了。。


看了一下数据库文件

common_staff_customerInfo.frm

common_staff_customerInfo.ibd

这两个文件都在。。也就是说表已经被删除了,数据文件居然留下 了。。。

我们的数据库居然删除表不会删除.frm和ibd文件。。看了my.cnf配置,里面有个

symbolic-links=0

这个参数。这可能与我设置了库数据软链到其他盘有关,把这个参数删除了,测试了一下删除表是可以的了

上一篇:java四元运算