On this page
Kafka Improvement Proposal
KIP-545: MirrorMaker 2 syncs consumer offsets to the target
KIP-545 lets MirrorMaker 2 write translated consumer group offsets straight into the target cluster. A consumer that fails over to the other cluster then starts near where it stopped, without a separate tool. It is off by default and turned on with sync.group.offsets.enabled=true.
- Proposal
- KIP-545, support automated consumer offset sync across clusters in MM 2.0
- Status
- Shipped Since Kafka 2.7 (2020), opt-in with sync.group.offsets.enabled.
- Area
- Across clusters
- Proposal page
- KIP-545 on the Apache Kafka wiki
Why it was needed
MirrorMaker 2 (KIP-382) already translated committed offsets, because a record sits at a different offset in the target cluster, but it only published them as checkpoints. Before a failover someone had to read the checkpoints and reset each consumer group, at the worst possible moment.
What it changes
The checkpoint task periodically writes the translated offsets into the target's __consumer_offsets for each mirrored group. It only does so while the group has no active members on the target, and never moves an offset backwards. Translation is approximate, so after a failover consumers may re-read a few records.
How to use it
- Set sync.group.offsets.enabled=true for the flow, for example primary->dr.sync.group.offsets.enabled=true; sync.group.offsets.interval.seconds (default 60) sets how often.
- Keep emit.checkpoints.enabled=true (the default); the offsets come from the checkpoints.
Where it stands
Shipped in Kafka 2.7 and part of MirrorMaker 2 ever since. Offset-preserving mirrors, Confluent Cluster Linking and Apache Kafka Cluster Mirroring (KIP-1279), avoid translation altogether.
What comes next
Stable. The old MirrorMaker metrics are deprecated (KIP-1280) and go away in Kafka 5.0.
See it in the simulator
- MirrorMaker 2 offset translation for Kafka consumer failover (Offset translation across clusters) Step 2: First checkpoint: committed offset 3 translated to dr Open at this step: MirrorMaker 2 offset translation for Kafka consumer failover
- MirrorMaker 2 offset translation for Kafka consumer failover (Offset translation across clusters) Step 4: Failover: consumer resumes at the checkpoint (offset 3), not 5 Open at this step: MirrorMaker 2 offset translation for Kafka consumer failover
Sources
- KIP-545: support automated consumer offset sync across clusters in MM 2.0
- Apache Kafka 4.4: MirrorMaker configs