Reputation: 2191
I am new to Kafka, I have created some topic called Hell0-Kafka3
Now I want to delete it. So I am issuing a command like this:
$ bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic Hello-Kafka3
Topic Hello-Kafka3 is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
Can someone help me to understand Note: on the last line ??
Upvotes: 23
Views: 42269
Reputation: 8968
Just ran into this (running kafka 2.8.2). Somehow I had to set delete.topic.enable=true
on ALL brokers (not just the one I was issuing the command on)
Not sure which one really helped but I did both
./kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic mytopic
and ./kafka-topics.sh --zookeeper x.x.x.x:2181 --delete --topic mytopic
Upvotes: 0
Reputation: 524
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>
Upvotes: 8
Reputation: 7091
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.
Upvotes: 28