Scenario 09.2.1 · Active-passive mirror
Kafka MirrorMaker 2 active-passive DR and replication lag
MirrorMaker lazily copies committed records to the DR region; cutting the link grows lag.
Run this scenario in the playgroundTwo regions ready - primary serves orders, dr mirrors. t+0.000s
Each region is its own cluster: orders lives on broker-1/broker-2 in primary, and the mm-1 link copies it into dr as the MM2 remote topic primary.orders on broker-3/broker-4. Both logs are empty, so there is nothing to lag yet.
Open at this step: step 1, Two regions ready - primary serves orders, dr mirrorsThree records committed on primary - dr not yet mirrored (lag 3). t+0.900s
p1 has produced O1, O2 and O3 with acks=all, and primary's orders HW is 3. dr's primary.orders is still at 0: MM2 copies committed records asynchronously, so the producer's ack never waits for the DR copy.
Open at this step: step 2, Three records committed on primary - dr not yet mirrored (lag 3)Mirror still trailing - dr lags the active region by a few frames (lag 3). t+1.200s
Nothing has changed on either side - primary is at HW 3 and dr is still at 0. This is normal async mirror lag; if primary were lost right now, those 3 records would be missing on dr.
Open at this step: step 3, Mirror still trailing - dr lags the active region by a few frames (lag 3)Mirror caught up - dr holds all three (lag 0). t+1.700s
MM2 has copied all three records into primary.orders (dr HW 3), with source offsets 0, 1, 2 mapped one-to-one. Lag is 0, so a failover at this moment would lose nothing.
Open at this step: step 4, Mirror caught up - dr holds all three (lag 0)Inter-region link cut - mirror stalled, lag grows (lag 2). t+2.600s
The network between the regions was split at t=2000. p1 keeps producing O4 and O5 to primary (HW 5) because its local ISR is healthy, but dr's primary.orders is stuck at 3. Those 2 un-mirrored records are exactly the data at risk if you fail over now.
Open at this step: step 5, Inter-region link cut - mirror stalled, lag grows (lag 2)What you start with
An active-passive disaster-recovery setup: a primary cluster and a separate DR cluster, with MirrorMaker asynchronously copying committed records from primary to DR. Because mirroring is async, the DR copy always trails the primary by some lag. We produce a few records, then cut the inter-region link to watch replication lag grow.
Step by step
- Two regions ready - primary serves orders, dr mirrors t+0.000s Each region is its own cluster: orders lives on broker-1/broker-2 in primary, and the mm-1 link copies it into dr as the MM2 remote topic primary.orders on broker-3/broker-4. Both logs are empty, so there is nothing to lag yet. Open at this step: step 1, Two regions ready - primary serves orders, dr mirrors
- Three records committed on primary - dr not yet mirrored (lag 3) t+0.900s p1 has produced O1, O2 and O3 with acks=all, and primary's orders HW is 3. dr's primary.orders is still at 0: MM2 copies committed records asynchronously, so the producer's ack never waits for the DR copy. Open at this step: step 2, Three records committed on primary - dr not yet mirrored (lag 3)
- Mirror still trailing - dr lags the active region by a few frames (lag 3) t+1.200s Nothing has changed on either side - primary is at HW 3 and dr is still at 0. This is normal async mirror lag; if primary were lost right now, those 3 records would be missing on dr. Open at this step: step 3, Mirror still trailing - dr lags the active region by a few frames (lag 3)
- Mirror caught up - dr holds all three (lag 0) t+1.700s MM2 has copied all three records into primary.orders (dr HW 3), with source offsets 0, 1, 2 mapped one-to-one. Lag is 0, so a failover at this moment would lose nothing. Open at this step: step 4, Mirror caught up - dr holds all three (lag 0)
- Inter-region link cut - mirror stalled, lag grows (lag 2) t+2.600s The network between the regions was split at t=2000. p1 keeps producing O4 and O5 to primary (HW 5) because its local ISR is healthy, but dr's primary.orders is stuck at 3. Those 2 un-mirrored records are exactly the data at risk if you fail over now. Open at this step: step 5, Inter-region link cut - mirror stalled, lag grows (lag 2)
The takeaway
Async mirroring (MirrorMaker) gives cross-cluster DR but never zero lag: the DR cluster trails the primary, and any link interruption widens that gap - and the gap is exactly the data at risk on failover.
Configs in this scenario
-
acksHow many replicas must have a write before the producer counts it as sent: 0 (none), 1 (the leader only) or all (every in-sync replica, the default, and required for idempotence). How acks works
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=09.2.1" title="Kafka Simulator: Active-passive mirror" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/dr-mirror/">Kafka MirrorMaker 2 active-passive DR and replication lag</a></p> Further reading
More in Disaster recovery
- Kafka stretched cluster across two data centers
- 2.5-DC Kafka stretched cluster with a witness site
- 3-DC Kafka cluster: the KRaft quorum survives losing a site
- Kafka in two DCs without a witness: KRaft quorum is lost
- Kafka data center failure: leader failover to the other DC
- Kafka network split inside one DC: ISR drops to the floor
- Kafka DR failover with MirrorMaker 2: measuring RPO
- Active-active Kafka with MirrorMaker 2 and region topics
- MirrorMaker 2 offset translation for Kafka consumer failover
- Kafka failback after a MirrorMaker 2 DR failover
- Active-active Kafka DR drill: move clients to the survivor
- Confluent MRC observers: Kafka replicas outside the ISR
- Kafka observer lag in Confluent Multi-Region Clusters
- Kafka observer promotion in Confluent Multi-Region Clusters
- Confluent MRC observer promotion: losing the Kafka leader DC
- Kafka replica placement: durability vs latency across DCs
- Confluent Cluster Linking: offset-preserving Kafka mirroring
- Kafka mirror topics (Confluent): read-only until promoted
- Cluster Linking vs MirrorMaker 2 for Kafka replication
- Kafka consumer offset sync: Cluster Linking vs MirrorMaker 2
- Kafka failover and failback with Confluent Cluster Linking