I am a big fan of Kafka, and I am using it a lot to connect my domains and services with scalable and performant asynchronous communication. Over the time, I sometimes run into a situation where I need to get rid of a topic that has become obsolete. In some (rare) cases, topics are "sticky", and even though I ordered a deletion, they somehow remain.
This is where zookeeper-shell comes into play. Let's assume for this example that I
- have a zookeeper instance running on a server named zookeeper-1, listening on port 2181.
- let's further assume that I have a topic named NOTNEEDEDANYMORE that I want to get rid of.
- let's finally assume that the normal way of deleting the topic didn't work (for whatever reason)
In this special situation, the following two commands will do the job:
$ zookeeper-shell zookeeper-1:2181
# now I am connected to the shell
[] rmr /brokers/topics/NOTNEEDEDANYMORE
[] rmr /admin/delete_topics/NOTNEEDEDANYMORE
# by now, the topic is gone
# quit the shell
[] quit
$