Reputation: 3530
I try to shift back the offset of topic within consumer group using following command:
bin/kafka-consumer-groups.sh --bootstrap-server loclahost:9092 --group xxx-0 --topic schedule-changed --reset-offsets --shift-by -2 --execute
(Yes, I'm using kafka version > 1.x) As a result I got a message:
Error: Assignments can only be reset if the group 'xxx-0' is inactive, but the current state is Stable.
How can I change the state of group from 'stable' to 'inactive'?
Upvotes: 35
Views: 40643
Reputation: 8162
I had the same problem, but in contrast to kellanburket's answer there was no consumer running any more. In that case, I had to delete the consumer group:
kafka-consumer-groups --zookeeper a.zookeeper.host:2181 --group the-group-name --delete
In newer versions of kafka, you may need to use:
kafka-consumer-groups --bootstrap-server $SERVERS --group the-group-name --delete
Upvotes: 8
Reputation: 12853
The reset-offsets
option for kafka-consumer-groups.sh first checks to see if a consumer is active in that group before attempting to shift back your offsets. 'Stable' means you have an active consumer running.
Use the describe-groups
option to check on your consumer groups:
bin/kafka-consumer-groups.sh --bootstrap-server $SERVERS --group $GROUP --describe
If you see an entry under 'CONSUMER-ID/HOST/CLIENT-ID' for your topic, that means you still have a consumer running. Once you shut down the app that's keeping the consumer alive your consumer group will be inactive and you'll be able to shift your offsets at will.
Upvotes: 36