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

后端 未结 13 1888
陌清茗
陌清茗 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:16

    1. Stop ZooKeeper and Kafka
    2. In server.properties, change log.retention.hours value. You can comment log.retention.hours and add log.retention.ms=1000. It would keep the record on Kafka Topic for only one second.
    3. Start zookeeper and kafka.
    4. Check on consumer console. When I opened the console for the first time, record was there. But when I opened the console again, the record was removed.
    5. Later on, you can set the value of log.retention.hours to your desired figure.

提交回复
热议问题