将 kafka 连接器重命名为强制重启连接器
Renaming kafka connector as a force restart connector
我有这个相对简单的 postgres 源 my-connector
,运行 作为 debezium/connect:latest
docker 容器。
{"name":"my-connector","config":
{"connector.class":"io.debezium.connector.postgresql.PostgresConnector",
"database.user":"postgres",
"database.dbname":"postgres",
"slot.name":"my_slot",
"tasks.max":"1",
"database.server.name":"postgres",
"database.port":"5432",
"schema.whitelist":"public",
"database.hostname":"postgres",
"database.password":"mypass",
"name":"my-connector",
"tasks":[{"connector":"my-connector","task":0}],
"type":"source"}
如果我尝试使用 curl -i -X POST localhost:8083/connectors/my-connector/restart
重新启动,我会收到一条成功的 return 消息:
HTTP/1.1 204 No Content
Date: Mon, 22 Mar 2021 11:39:59 GMT
Server: Jetty(9.4.20.v20190813)
但是,我没有得到连接器将 postgres 表中的数据推送到相应的 kafka 主题的预期行为。作为解决方法,我可以创建一个具有相同配置的新连接器并将其名称更改为 my-connector2
,我将获得预期的行为。因此,我只想问一下是否有更优雅的重启连接器来实现预期的行为?
这是预期的行为:
https://debezium.io/documentation/reference/tutorial.html#restarting-kafka-connect-service
The Kafka Connect service starts, connects to Kafka, reads the
previous service’s configuration, and starts the registered connectors
that will resume where they last left off.
您要做的是重置偏移量:
https://debezium.io/documentation/faq/#how_to_remove_committed_offsets_for_a_connector
我有这个相对简单的 postgres 源 my-connector
,运行 作为 debezium/connect:latest
docker 容器。
{"name":"my-connector","config":
{"connector.class":"io.debezium.connector.postgresql.PostgresConnector",
"database.user":"postgres",
"database.dbname":"postgres",
"slot.name":"my_slot",
"tasks.max":"1",
"database.server.name":"postgres",
"database.port":"5432",
"schema.whitelist":"public",
"database.hostname":"postgres",
"database.password":"mypass",
"name":"my-connector",
"tasks":[{"connector":"my-connector","task":0}],
"type":"source"}
如果我尝试使用 curl -i -X POST localhost:8083/connectors/my-connector/restart
重新启动,我会收到一条成功的 return 消息:
HTTP/1.1 204 No Content
Date: Mon, 22 Mar 2021 11:39:59 GMT
Server: Jetty(9.4.20.v20190813)
但是,我没有得到连接器将 postgres 表中的数据推送到相应的 kafka 主题的预期行为。作为解决方法,我可以创建一个具有相同配置的新连接器并将其名称更改为 my-connector2
,我将获得预期的行为。因此,我只想问一下是否有更优雅的重启连接器来实现预期的行为?
这是预期的行为:
https://debezium.io/documentation/reference/tutorial.html#restarting-kafka-connect-service
The Kafka Connect service starts, connects to Kafka, reads the previous service’s configuration, and starts the registered connectors that will resume where they last left off.
您要做的是重置偏移量:
https://debezium.io/documentation/faq/#how_to_remove_committed_offsets_for_a_connector