In this post we will see how to delete a Kafka topic and get the details of the topic before deleting it.
Do this step if you are planning to recreate the topic with the same configuration after deleting the topic.
kafka-topics.sh --zookeeper <zkhost>:2181 --topic <topic name> --describe
kafka-configs --zookeeper <zkhost>:2181 --describe --entity-type topics --entity-name <topic name>
Click here if you want to purge the messages in the topic before deleting this topic.
Set the delete.topic.enable property to true in server.properties file under $KAFKA_HOME/config/ directory.
delete.topic.enable=true
Issue the delete command on the topic
kafka-topics.sh --zookeeper <zkhost>:2181 --topic <topic name> --delete
That is it, the Kafka topic will now be deleted.
1 Comment
[…] source: https://www.bigdatainrealworld.com/how-to-delete-a-kakfa-topic/ […]