dcguim
dcguim

Reputation: 13

Renaming kafka connector as a force restart connector

I have this relatively simple postgres source my-connector, running as a debezium/connect:latest docker container.

{"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"}

If I try to restart with curl -i -X POST localhost:8083/connectors/my-connector/restart, I get a successfull return message:

HTTP/1.1 204 No Content
Date: Mon, 22 Mar 2021 11:39:59 GMT
Server: Jetty(9.4.20.v20190813)

However, I do not get the expected behaviour of the connector pushing the data in the postgres tables to the respective kafka topics. As a workaround, I could create a new connector with the same configurations and change it's name to say my-connector2, I would obtain the expected behaviour. Therefore, I would just like to ask if there is an more elegant to restart the connector to achieve the expected behaviour?

Upvotes: 1

Views: 3115

Answers (1)

senjin.hajrulahovic
senjin.hajrulahovic

Reputation: 3191

This is expected behaviour:

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.

What you want to do is to reset the offset:

https://debezium.io/documentation/faq/#how_to_remove_committed_offsets_for_a_connector

Upvotes: 1

Related Questions