On this page
Kafka Improvement Proposal
KIP-382: MirrorMaker 2, replication between Kafka clusters
KIP-382 is MirrorMaker 2, the tool Apache Kafka ships for copying data between clusters, for disaster recovery or for moving data between regions. It runs on Kafka Connect, copies topics with their configs, and translates consumer group offsets, because a record lands at a different offset in the target cluster than in the source.
- Proposal
- KIP-382, MirrorMaker 2.0
- Status
- Shipped Since Kafka 2.4 (2019); the original MirrorMaker was removed in Kafka 4.0.
- Area
- Across clusters
- Proposal page
- KIP-382 on the Apache Kafka wiki
Why it was needed
The original MirrorMaker was a consumer glued to a producer. It copied records and nothing else: no topic configs, no new partitions, no consumer offsets, and no protection against copying a topic back and forth in a loop. Failing a consumer over to the other cluster meant guessing where to start.
What it changes
MirrorMaker 2 is a set of Kafka Connect connectors. MirrorSourceConnector consumes from the source and produces to the target, under a prefixed name by default (orders becomes primary.orders), which also prevents loops. It writes offset syncs as it goes, and MirrorCheckpointConnector uses them to translate committed consumer offsets into checkpoints on the target. Since the target offsets are produced anew, the translation is approximate: after a failover a consumer may re-read a few records.
How to use it
- Run connect-mirror-maker.sh with a properties file naming the clusters and the flows, such as primary->dr.enabled=true, or deploy the connectors on an existing Connect cluster.
- Set sync.group.offsets.enabled=true (KIP-545) so translated offsets are written to the target groups and consumers can fail over without tooling.
Where it stands
Shipped in Kafka 2.4 and the standard open-source way to mirror Kafka. KIP-545 (Kafka 2.7) added automatic consumer offset sync. The legacy MirrorMaker 1 was deprecated in 3.0 and removed in Kafka 4.0.
What comes next
MirrorMaker 2 stays. KIP-1280 deprecated its current metrics in Kafka 4.3, to be replaced and removed in 5.0. Apache Kafka is also getting a second approach: Cluster Mirroring (KIP-1279, accepted in September 2026) copies the log inside the brokers with the same offsets, the model Confluent Cluster Linking made popular.
See it in the simulator
- 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
- Kafka MirrorMaker 2 active-passive DR and replication lag (Active-passive mirror) Step 4: Mirror caught up - dr holds all three (lag 0) Open at this step: Kafka MirrorMaker 2 active-passive DR and replication lag
- Confluent Cluster Linking: offset-preserving Kafka mirroring (Cluster Linking: byte-for-byte offset-preserving mirror) Step 2: Offsets preserved (cluster link) vs translated (MM2) Open at this step: Confluent Cluster Linking: offset-preserving Kafka mirroring