Support Questions

Find answers, ask questions, and share your expertise

How are offsets reset in kafka 0.11

avatar
Contributor

I'm using kafka 0.11. I'm trying to reset the offset of a topic in a consumer group but don't see consistency among the option. How is the offset calculated for different options in kafka-consumer-groups ?

user1@xxxxxxxxxxxx:~$ kafka-consumer-groups.sh --bootstrap-server xxxxxxxxxxxx.devkafka.com:9092 --group testgroup --reset-offsets--by-duration PT1H30M0S--topic Test_Upgrade --export --command-config client.properties 2>/dev/null

Test_Upgrade,1,615

Test_Upgrade,0,625

user1@xxxxxxxxxxxx:~$ dateThu May 31 15:30:45 BST 2018

user1@xxxxxxxxxxx:~$ kafka-consumer-groups.sh --bootstrap-server xxxxxxxxxxxx.devkafka.com:9092 --group testgroup --reset-offsets--to-datetime 2018-05-31T14:00:00.000--topic Test_Upgrade --export --command-config client.properties 2>/dev/null

Test_Upgrade,1,754

Test_Upgrade,0,772

1 ACCEPTED SOLUTION

avatar
Expert Contributor

by-duration is specified relative to the current time, but --to-datetime is in UTC unless otherwise specified. Since you are on BST (British Summer Time), you'd need to use UTC+1, specifying "--to-datetime 2018-05-31T14:00:00.000+01" to get the same result - assuming I have my ISO standards right...

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

by-duration is specified relative to the current time, but --to-datetime is in UTC unless otherwise specified. Since you are on BST (British Summer Time), you'd need to use UTC+1, specifying "--to-datetime 2018-05-31T14:00:00.000+01" to get the same result - assuming I have my ISO standards right...

avatar
Contributor

Thanks @William Brooks will try that. From my initial checks, it seems working

avatar
Expert Contributor

Glad it worked! If this answer helps, please mark it as an accepted answer, too!