$ kafka-topics --zookeeper localhost:2181 --list | grep my-topic
my-topic
$ kafka-topics --zookeeper localhost:2181 --delete --topic my-topic
Topic my-topic is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
$ kafka-topics --zookeeper localhost:2181 --list | grep my-topic
my-topic - marked for deletion
It's been hours since then, and the topic has still not been deleted.
I've seen suggestions that I should put delete.topic.enable
in my server.properties
and restart kafka. I've tried this. It hasn't worked.
$ grep -F delete.topic.enable /usr/local/etc/kafka/server.properties
delete.topic.enable = true
(Why wouldn't this be set by default?)
In any case, these suggestions have all been for kafka 0.* and I am on a newer version.
$ brew list --versions kafka
kafka 1.1.0
How do I delete topics?
I can shutdown kafka and zookeeper, run rm -r /usr/local/var/lib/kafka-logs /usr/local/var/run/zookeeper/data
, then start zookeeper and kafka again. But this is rather drastic. Surely there should be some way of persuading kafka-topics
to actually delete a topic?