How to purge or delete messages in a Kafka topic?
December 28, 2020How does Shuffle Hash Join work in Spark?
January 1, 2021In this post we will see how to delete a Kafka topic and get the details of the topic before deleting it.
Fetch current details of the topic
Do this step if you are planning to recreate the topic with the same configuration after deleting the topic.
Get details of topic
kafka-topics.sh --zookeeper <zkhost>:2181 --topic <topic name> --describe
Get configuration details of topic
kafka-configs --zookeeper <zkhost>:2181 --describe --entity-type topics --entity-name <topic name>
Delete the topic
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/ […]