How to delete a Kakfa topic? - Big Data In Real World

How to delete a Kakfa topic?

How to purge or delete messages in a Kafka topic?
December 28, 2020
How does Shuffle Hash Join work in Spark?
January 1, 2021

In 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.

Big Data In Real World
Big Data In Real World
We are a group of Big Data engineers who are passionate about Big Data and related Big Data technologies. We have designed, developed, deployed and maintained Big Data applications ranging from batch to real time streaming big data platforms. We have seen a wide range of real world big data problems, implemented some innovative and complex (or simple, depending on how you look at it) solutions.
gdpr-image
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.

Hadoop In Real World is now Big Data In Real World!

X