Is there a way to delete all the data from a topic or delete the topic before every run?

后端 未结 13 1871
陌清茗
陌清茗 2020-12-12 10:33

Is there a way to delete all the data from a topic or delete the topic before every run?

Can I modify the KafkaConfig.scala file to change the logRetentionHour

13条回答
  •  天涯浪人
    2020-12-12 11:21

    For brew users

    If you're using brew like me and wasted a lot of time searching for the infamous kafka-logs folder, fear no more. (and please do let me know if that works for you and multiple different versions of Homebrew, Kafka etc :) )

    You're probably going to find it under:

    Location:

    /usr/local/var/lib/kafka-logs


    How to actually find that path

    (this is also helpful for basically every app you install through brew)

    1) brew services list

    kafka started matbhz /Users/matbhz/Library/LaunchAgents/homebrew.mxcl.kafka.plist

    2) Open and read that plist you found above

    3) Find the line defining server.properties location open it, in my case:

    • /usr/local/etc/kafka/server.properties

    4) Look for the log.dirs line:

    log.dirs=/usr/local/var/lib/kafka-logs

    5) Go to that location and delete the logs for the topics you wish

    6) Restart Kafka with brew services restart kafka

提交回复
热议问题