What is delete.topic.enable in kafka
In the last few versions of Apache’s Kafka, deleting a topic is fairly easy. You just need to set one property in the configuration to ‘true’, and just issue a command to delete a topic. It’ll be deleted in no time. But sometimes, for several reasons unknown to mere mortals such as ourselves, the deletion of a topic doesn’t happen automatically. If this is happening to you, don’t sweat just yet; there’s another easy way to delete a topic. First, let’s see how to configure Kafka to delete a topic with just a command. ‘cd’ into your Kafka installation directory, then into the ‘config’ directory. Here, you’ll find a server.properties file (the file name could be different if you’ve renamed your copy). Open the properties file in your favorite text editor, for me it’s Vim. Add the following line, or change the value of the property to true:
delete.topic.enable=true
Now go to the ‘bin’ directory, where you’ll find a file named ‘kafka-topics.sh.’ This is the file we’ll be using to delete a topic. The command to delete a topic is this:
./kafka-topics.sh --zookeeper localhost:2181 --delete --topic <topic_name>
You have to set delete.topic.enable
to true in config/server.properties before issuing this delete-topic command, otherwise, Kafka ignores the command you submit and does nothing for the topic.