kafka msql连接器配置文件不工作

jm2pwxwz  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(281)

我有一个kafka的配置文件,可以很好地从mysql数据库读取数据

name=local-jbdc
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
connection.url=jdbc:mysql://localhost:3306/book
connection.user=root
connection.password=newpass
topic.prefix=quickstart-events
mode=incrementing
incrementing.column.name=__id
query=select * from book_table
offset.flush.timeout.ms=5000
buffer.memory=200
poll.interval.ms=10000
tasks.max=1

现在当我拿出 query 并提供 table.whitelist 它什么也看不到。甚至没有错误。
确认如下所示

name=local-jbdc
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
connection.url=jdbc:mysql://localhost:3306/book
connection.user=root
connection.password=newpass
topic.prefix=quickstart-events
mode=incrementing
incrementing.column.name=__id
table.whitelist=book_table
offset.flush.timeout.ms=5000
buffer.memory=200
poll.interval.ms=10000
tasks.max=1

有人能帮我了解这个问题的根本原因吗。另外,我将如何能够做多个表的增量模式。
编辑
当我用键盘上的ctrl+c停止Kafka
有一根木头像这样冒出来

[2020-11-30 12:35:38,057] INFO [ReplicaManager broker=0] Shut down completely (kafka.server.ReplicaManager)
[2020-11-30 12:35:38,058] INFO Shutting down. (kafka.log.LogManager)
[2020-11-30 12:35:38,106] INFO [ProducerStateManager partition=connect-status-4] Writing producer snapshot at offset 394 (kafka.log.ProducerStateManager)
[2020-11-30 12:35:38,158] INFO [ProducerStateManager partition=__consumer_offsets-18] Writing producer snapshot at offset 1 (kafka.log.ProducerStateManager)
[2020-11-30 12:35:38,219] INFO [ProducerStateManager partition=quickstart-eventsbook_table-0] Writing producer snapshot at offset 19645 (kafka.log.ProducerStateManager)
[2020-11-30 12:35:38,239] INFO [ProducerStateManager partition=quickstart-book_table-0] Writing producer snapshot at offset 2652 (kafka.log.ProducerStateManager)```
rqcrx0a6

rqcrx0a61#

问题很简单。当提供table.whitelist时,连接器将创建一个主题 topic.prefix 附加到表名。在我的例子中,它创建了一个名为 quickstart-eventsbook_table . 提供查询时 topic.prefix 也被当作发送数据的主题。

相关问题