简体   繁体   中英

How to Force Delete Kafka Topic?

We have a topic where even after issuing the kafka-topics 'delete' command, it does not go away. It simply says "TOPIC.ABC - marked for deletion". This property 'delete.topic.enable=true' is set to true on all brokers. Is this a known issue and is there a workaround for this? Like manually deleting the topic folder and removing the topic entries in the zookeeper config?

Forcing a topic delete

A Kafka topic marked for deletion can be deleted by directly logging into the ZooKeeper shell and removing the topic metadata from the cluster. We also recommend removing the log segments from each broker that are associated with the topic.

  1. zookeeper-shell
  2. rmr /config/topics/
  3. rmr /brokers/topics/
  4. rmr /admin/delete_topics/
  5. For each broker:
    • Shut down the broker
    • rm -R ${log.dirs}/-*
    • Start up the broker

Note: Step 5 should be done with care to ensure you are only removing the log directories for the topic you are intending to delete

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM