---
title: "Kafka MirrorMaker 2 active-passive DR and replication lag"
description: "MirrorMaker 2 copies committed orders records from the primary Kafka cluster to DR asynchronously. Cut the link and lag grows: O4 and O5 exist on primary only."
url: https://monedula.dev/kafka-simulator/scenarios/dr-mirror/
---

# Kafka MirrorMaker 2 active-passive DR and replication lag

Scenario 09.2.1 · Active-passive mirror. 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 it: https://monedula.dev/kafka-simulator/playground/?scenario=09.2.1

## 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](https://monedula.dev/kafka-simulator/playground/?scenario=09.2.1&t=0)
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](https://monedula.dev/kafka-simulator/playground/?scenario=09.2.1&t=1)
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](https://monedula.dev/kafka-simulator/playground/?scenario=09.2.1&t=2)
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](https://monedula.dev/kafka-simulator/playground/?scenario=09.2.1&t=3)
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](https://monedula.dev/kafka-simulator/playground/?scenario=09.2.1&t=4)

## 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

- [`acks`](https://kafka.apache.org/43/configuration/producer-configs/#producerconfigs_acks): How 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](https://monedula.dev/kafka-simulator/configs/acks/)

## Further reading

- [Apache Kafka documentation](https://kafka.apache.org/43/operations/geo-replication-cross-cluster-data-mirroring/)
