20

I created a cassandra-sink connector after that I made some changes in connector.properties file. After stopping the worker and starting it again, now when I add the connector using:

java -jar kafka-connect-cli-1.0.6-all.jar create cassandra-sink-orders < cassandra-sink-distributed-orders.properties

I get the following error:

Error: the Kafka Connect API returned: Connector cassandra-sink-orders already exists (409) 

How can I remove the existing connector?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
el323
  • 2,760
  • 10
  • 45
  • 80

2 Answers2

60

To delete a connector, you can run:

curl -X DELETE http://localhost:8083/connectors/<connector-name>
foxwendy
  • 2,819
  • 2
  • 28
  • 50
13

You can use the Kafka Connect REST API, which includes an endpoint for DELETEing a connector.

curl -X DELETE http://$KAFKACONNECTWORKER_HOST:$KAFKACONNECTWORKER_PORT/connectors/$CONNECTOR_NAME

For example:

curl -X DELETE http://localhost:8083/connectors/src-jdbc-orders

See it in action here: https://www.youtube.com/watch?v=1EenWEm-5dg&t=378s

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
  • 2
    This might be intentional, but for me this was counter intuitive, when you delete a connector, and you POST a connector with the same name, it re-uses to some degree the old config. For example I had a corrupt Debezium connector with a binlog offset that no longer existed. I deleted it, then created it again, thinking it would start from scratch with the first binlog it could find, but it started at the same broken offset. – jlos Mar 11 '22 at 08:33