Created on 02-03-2017 04:44 PM - edited 08-17-2019 05:08 AM
If you’re using Apache Kafka, you know it persists all the messages on disk as a distributed commit log. You might sometimes want to take advantage of that and reprocess some of the messages. Assuming that you want to reprocess all the messages currently stored on your brokers and you set auto.offset.reset to smallest, you can just delete your consumers’ data from Zookeeper. After restarting, your consumers should start from the beginning. But what if you forgot or didn’t want to set auto.offset.reset in you consumers to smallest? Then you can manually set the offsets for each partition for your consumers to the smallest currently available offset.
kafka-topics --list --zookeeper localhost:2181
kafka-run-class kafka.tools.GetOffsetShell --broker-list localhost:9092 -topic vital_signs --time -1
$ ZOOKEEPER_HOME/zkCli $ ls /consumers/flasfka/offsets/vital_signs $ set /consumers/flasfka/offsets/vital_signs/0 11492949
kafka-run-class kafka.tools.GetOffsetShell --broker-list localhost:9092 -topic vital_signs --time -1
Created on 06-13-2017 10:37 PM
@Vedant Jain Very interesting article. And usefull
I am looking for a way though to do to same for NewConsumers that store their offset in the topic __consumer_offsets.
Do you know how to manage that offset?
Created on 04-23-2018 05:39 AM
That's pretty useful, but only if you're storing the offsets in Zookeeper. Can someone please update this article with instructions for how to reset offsets when they are stored in Kafka?
User | Count |
---|---|
763 | |
379 | |
316 | |
309 | |
270 |