Purge Kafka Topic

后端 未结 19 2399
慢半拍i
慢半拍i 2020-11-28 00:06

Is there a way to purge the topic in kafka?

I pushed a message that was too big into a kafka message topic on my local machine, now I\'m getting an

19条回答
  •  天涯浪人
    2020-11-28 01:12

    Here are the steps I follow to delete a topic named MyTopic:

    1. Describe the topic, and take not of the broker ids
    2. Stop the Apache Kafka daemon for each broker ID listed.
    3. Connect to each broker, and delete the topic data folder, e.g. rm -rf /tmp/kafka-logs/MyTopic-0. Repeat for other partitions, and all replicas
    4. Delete the topic metadata: zkCli.sh then rmr /brokers/MyTopic
    5. Start the Apache Kafka daemon for each stopped machine

    If you miss you step 3, then Apache Kafka will continue to report the topic as present (for example when if you run kafka-list-topic.sh).

    Tested with Apache Kafka 0.8.0.

提交回复
热议问题