Consumer Group Management
IntermediateManaging Kafka consumer groups involves listing groups, checking offsets and lag, resetting offsets for replay, and deleting stale groups — essential ops skills for production incidents.
Overview
Every consumer group has an offset per partition. Admins frequently reset offsets to replay events after a bug fix, check partition owners, or clean up zombie groups.
Consumer Group CLI Commands
kafka-consumer-groups.sh is the primary tool for consumer group operations.
# List all consumer groups
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
# Describe a group (partition owners, offsets, lag)
kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--group order-processor --describe
# Reset to earliest (replay all messages)
kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--group order-processor --topic orders \
--reset-offsets --to-earliest --execute
# Reset to specific datetime (replay last 24 hours)
kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--group order-processor --topic orders \
--reset-offsets --to-datetime 2024-01-01T00:00:00.000 --execute
# Delete a stale group (must be inactive)
kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--group stale-group --deleteKey Points to Remember
- 1Offset reset requires the consumer group to be inactive
- 2--to-earliest replays all retained messages; --to-latest skips to now
- 3--to-datetime is most useful for "replay the last N hours"
- 4Dry run first with --reset-offsets without --execute to preview
- 5offsets.retention.minutes (default 7 days) — group offsets expire if inactive
Interview Questions
Sign in to ask AriaHow do you reset a Kafka consumer group offset to replay messages from the last 24 hours?
Why must a consumer group be inactive before you can reset its offsets?
What is the difference between --to-earliest and --to-latest when resetting offsets?
How would you handle replaying events after a bug fix without double-processing in other consumer groups?
What happens to a consumer group offset when the group has been inactive longer than offsets.retention.minutes?
Ask Aria about Consumer Group Management
Your personal AI tutor — ask anything about this concept
Revision Status
Personal Notes
Sign in to save personal notes for this topic.
Discussion
Sign in to join the discussion.