Deletion of a topic has been supported since 0.8.2.x version. You have to enable topic deletion (setting delete.topic.enable
to true) on all brokers first.
Note: Ever since 1.0.x, the functionality being stable, delete.topic.enable
is by default true
.
Follow this step by step process for manual deletion of topics
- Stop Kafka server
- Delete the topic directory, on each broker (as defined in the
logs.dirs
and log.dir
properties) with rm -rf
command
- Connect to Zookeeper instance:
zookeeper-shell.sh host:port
- From within the Zookeeper instance:
- List the topics using:
ls /brokers/topics
- Remove the topic folder from ZooKeeper using:
rmr /brokers/topics/yourtopic
- Exit the Zookeeper instance (Ctrl+C)
- Restart Kafka server
- Confirm if it was deleted or not by using this command
kafka-topics.sh --list --zookeeper host:port