Monedula

Scenario 09.2.1 · Active-passive mirror

Kafka MirrorMaker 2 active-passive DR and replication lag

Disaster recovery · Advanced · about 3 min · Apache Kafka 4.3

MirrorMaker lazily copies committed records to the DR region; cutting the link grows lag.

Run this scenario in the playground

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

  1. 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
  2. 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)
  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)
  4. 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)
  5. 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

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

Apache Kafka documentation

More in Disaster recovery

All scenarios