重新启动数据库后尝试重新启动 debezium mysql 连接器时出错
Posted
技术标签:
【中文标题】重新启动数据库后尝试重新启动 debezium mysql 连接器时出错【英文标题】:Error while trying to restart debezium mysql connector after restarting the db 【发布时间】:2017-09-17 23:56:16 【问题描述】:mysql ROW 级别的 binloging 已启用。
ERROR Failed to start the connector (see other exception), but got this error while cleaning up (io.debezium.connector.mysql.MySqlConnectorTask:183)
java.lang.NullPointerException
at io.debezium.connector.mysql.MySqlConnectorTask.stop(MySqlConnectorTask.java:220)
at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:180)
at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:141)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:139)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:182)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
ERROR Task lk-mysql-connector-0 threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:141)
org.apache.kafka.connect.errors.ConnectException: io.debezium.text.ParsingException: Expecting token type 128 at line 1, column 1 but found 'DELETE': ===>> DELETE from mysql.rd
at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:192)
at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:141)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:139)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:182)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: io.debezium.text.ParsingException: Expecting token type 128 at line 1, column 1 but found 'DELETE': ===>> DELETE from mysql.rd
at io.debezium.text.TokenStream.consume(TokenStream.java:737)
at io.debezium.relational.ddl.DdlParser.consumeStatement(DdlParser.java:568)
at io.debezium.relational.ddl.DdlParser.parseUnknownStatement(DdlParser.java:376)
at io.debezium.connector.mysql.MySqlDdlParser.parseNextStatement(MySqlDdlParser.java:156)
at io.debezium.relational.ddl.DdlParser.parse(DdlParser.java:286)
at io.debezium.relational.ddl.DdlParser.parse(DdlParser.java:267)
at io.debezium.relational.history.AbstractDatabaseHistory.lambda$recover$0(AbstractDatabaseHistory.java:57)
at io.debezium.relational.history.KafkaDatabaseHistory.recoverRecords(KafkaDatabaseHistory.java:202)
at io.debezium.relational.history.AbstractDatabaseHistory.recover(AbstractDatabaseHistory.java:52)
at io.debezium.connector.mysql.MySqlSchema.loadHistory(MySqlSchema.java:312)
at io.debezium.connector.mysql.MySqlTaskContext.loadHistory(MySqlTaskContext.java:116)
at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:80)
... 8 more
【问题讨论】:
您能检查一下binlog format 是否设置为“行”吗?如果是,它之前是否设置为另一个值? 是的,之前它被设置为 MIXED。但如果是这种情况,它应该会在启动时失败,当我重新启动 mysql 并尝试再次重新启动 debezium 以连接到 mysql 时,就会发生这种情况。 【参考方案1】:升级到 debezium 0.5.2,这是 RDS 公认的问题,他们修复了它:
http://debezium.io/docs/releases/
https://issues.jboss.org/projects/DBZ/issues/DBZ-216?filter=allissues
【讨论】:
以上是关于重新启动数据库后尝试重新启动 debezium mysql 连接器时出错的主要内容,如果未能解决你的问题,请参考以下文章
Debezium Kafka Connect 需要重新启动才能使 PostgreSQL cdc 工作