Community Articles

Find and share helpful community-sourced technical articles.
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.
Labels (1)

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.

List all topics

kafka-topics --list --zookeeper localhost:2181


Get Offsets for the topic

kafka-run-class --broker-list localhost:9092 -topic vital_signs --time -1


Set the offset manually

$ ls /consumers/flasfka/offsets/vital_signs

$ set /consumers/flasfka/offsets/vital_signs/0 11492949


Verify the new offset

kafka-run-class --broker-list localhost:9092 -topic vital_signs --time -1


Super Collaborator

@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?

New Contributor

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?

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.
Version history
Last update:
‎08-17-2019 05:08 AM
Updated by:
Top Kudoed Authors