Purge Kafka Topic

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

    Thomas' advice is great but unfortunately zkCli in old versions of Zookeeper (for example 3.3.6) do not seem to support rmr. For example compare the command line implementation in modern Zookeeper with version 3.3.

    If you are faced with an old version of Zookeeper one solution is to use a client library such as zc.zk for Python. For people not familiar with Python you need to install it using pip or easy_install. Then start a Python shell (python) and you can do:

    import zc.zk
    zk = zc.zk.ZooKeeper('localhost:2181')
    zk.delete_recursive('brokers/MyTopic') 
    

    or even

    zk.delete_recursive('brokers')
    

    if you want to remove all the topics from Kafka.

提交回复
热议问题