How to reset the offset of messages consumed from Kafka

0 votes

I have earlier consumed messages from Kafka. Now I want to reset the offset of consumer messages. I am using the following command:

kafka-consumer-groups.bat --bootstrap-server localhost:9092 --group group1 --reset-offsets --to-earliest --all-topics

So, I am getting output as the topic as, the partition number of topics and the new offset as 0.  But when I am executing the below command

kafka-consumer-groups.bat --bootstrap-server localhost:9092 --group group1 --describe

I can still see the old offset number. Anyone can help me in understanding how can I reset the offset?

Jul 10, 2018 in Apache Kafka by coldcode
• 2,090 points
14,023 views

1 answer to this question.

0 votes

The reset option only prints the result of the operation, but to perform the operation, you need to add --execute parameter to the command

kafka-consumer-groups.bat --bootstrap-server localhost:9092 --group group1 --reset-offsets --to-earliest --all-topics --execute

Hope this will work

Join our Kafka course online today to become certified expert.

Thank You

answered Jul 10, 2018 by Shubham
• 13,490 points

Related Questions In Apache Kafka

0 votes
1 answer
+1 vote
1 answer

Kafka consumer not able to start reading messages from the last uncommitted offsets

Hi@prasant, I am not sure it will work ...READ MORE

answered Feb 18, 2020 in Apache Kafka by MD
• 95,460 points
9,696 views
0 votes
1 answer

What is the optimum number of producers to create in Kafka?

In general, a single producer for all ...READ MORE

answered Jul 10, 2018 in Apache Kafka by nitinrawat895
• 11,380 points
8,455 views
0 votes
1 answer

Explain to me the functionality of Kafka in a Big-Data Cluster

Let me explain to you about Apache ...READ MORE

answered Apr 30, 2019 in Apache Kafka by ravikiran
• 4,620 points
1,117 views
+1 vote
0 answers

Want to delete consumed topic programatically

directly delete kafka log folder and zeekeeper ...READ MORE

Jun 4, 2019 in Apache Kafka by sarvesh
1,649 views
+2 votes
9 answers

Writing the Kafka consumer output to a file

System.out.println(String.valueOf(output.offset()) + ": " + new String(bytes, ...READ MORE

answered Dec 7, 2018 in Apache Kafka by Harsh
38,585 views
0 votes
1 answer

How to commit message offsets in Kafka for reliable data pipeline?

You can use auto.commit.enable to allow Kafka ...READ MORE

answered Jul 10, 2018 in Apache Kafka by Shubham
• 13,490 points
3,582 views
+1 vote
14 answers

How can I delete all the messages from a Kafka topic?

To delete all the messages from a Kafka topic.  There are many approach ...READ MORE

answered Jun 19, 2020 in Apache Kafka by PAWAN
• 380 points
229,467 views
0 votes
1 answer

Not able to fetch messages from Kafka cluster

You need to add the hostname in ...READ MORE

answered Jul 10, 2018 in Apache Kafka by Shubham
• 13,490 points
3,035 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP