Skip to content

Offset Management

An offset records how far a consumer group has read in each partition. RobustMQ persists offsets in the meta layer and provides the full Kafka offset-management surface: commit, fetch, reset, delete, and lag computation. This page covers the relevant APIs and the kafka-consumer-groups.sh commands.

Commit and Fetch

APIPurposeNotes
OffsetCommitCommit offsetsA group writes a partition's consumption progress to meta (commitSync is a synchronous commit)
OffsetFetchFetch committed offsetsv8+ supports querying multiple groups in one batched request

Offsets are persisted in the meta layer, so a group can resume from its committed offset after a restart or membership change (see Consumer Group).

Reset Offsets

kafka-consumer-groups.sh --reset-offsets moves a group's offsets to a chosen position:

TargetMeaning
--to-earliestReset to the earliest available offset
--to-latestReset to the latest offset
--to-offset <n>Reset to a specific offset
--shift-by <n>Move the current offset forward/back by n (negative to rewind)

Execution modes:

ModeBehavior
--dry-runPreview the intended changes only, nothing is persisted
--executeActually commit the changes

Delete Offsets

kafka-consumer-groups.sh --delete-offsets deletes a group's committed offsets for a given topic/partition. Afterward the partition has no committed offset, and the next consumption starts per auto.offset.reset (see Consumer).

Lag

kafka-consumer-groups.sh --describe shows per-partition progress:

ColumnMeaning
CURRENT-OFFSETThe group's committed offset
LOG-END-OFFSETThe partition's latest offset (its end)
LAGThe lag = LOG-END-OFFSET − CURRENT-OFFSET

A larger lag means consumption is further behind production.

Persistence

All offsets are persisted in the Raft-based meta-service, managed in the same layer as cluster dynamic config and ACL/SCRAM/quotas (see System Architecture). The coordinator (Raft leader) handles offset reads and writes.

🎉 既然都登录了 GitHub,不如顺手给我们点个 Star 吧!⭐ 你的支持是我们最大的动力 🚀