Purge Kafka Topic

后端 未结 19 2398
慢半拍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:09

    Temporarily update the retention time on the topic to one second:

    kafka-topics.sh --zookeeper :2181 --alter --topic  --config retention.ms=1000
    

    And in newer Kafka releases, you can also do it with kafka-configs --entity-type topics

    kafka-configs.sh --zookeeper :2181 --entity-type topics --alter --entity-name  --add-config retention.ms=1000
    

    then wait for the purge to take effect (about one minute). Once purged, restore the previous retention.ms value.

提交回复
热议问题