Home/Learn/Apache Kafka/Multi-Datacenter Replication (MirrorMaker 2)

Multi-Datacenter Replication (MirrorMaker 2)

Advanced
Advanced

MirrorMaker 2 replicates Kafka topics across clusters and datacenters for disaster recovery, geo-replication, and data aggregation pipelines.

Overview

MM2 is built on Kafka Connect and provides active-active and active-passive replication. It mirrors topics, consumer group offsets, and ACLs. Remote topic naming (source.topic) prevents replication loops.

MirrorMaker 2 Configuration

Deploy MM2 as a Kafka Connect cluster. Define source and target clusters and which topics to replicate.

MirrorMaker 2 — active-passive replication
# mm2.properties
clusters=us-east, eu-west
us-east.bootstrap.servers=kafka-us-east:9092
eu-west.bootstrap.servers=kafka-eu-west:9092

# Replicate us-east → eu-west (active-passive)
us-east->eu-west.enabled=true
us-east->eu-west.topics=orders.*,payments.*
us-east->eu-west.groups=.*       # mirror consumer group offsets

replication.factor=3
tasks.max=4

# Start MM2
connect-mirror-maker.sh mm2.properties

Key Points to Remember

  • 1MM2 mirrors topics with source prefix (us-east.orders) to prevent loops
  • 2MM2 mirrors consumer group offsets for transparent failover
  • 3Active-passive: one cluster is primary, the other is DR standby
  • 4Active-active: bidirectional — requires careful loop prevention
  • 5CheckpointConnector translates remote offsets for seamless consumer failover

Interview Questions

Sign in to ask Aria
1

What is MirrorMaker 2 and how does it differ from MirrorMaker 1?

MediumConfluent
2

What is the remote topic naming convention in MM2 and why is it needed?

MediumAmazon
3

How does MM2 enable consumer groups to fail over to the DR cluster without reprocessing?

HardNetflix
4

What are the trade-offs between active-passive and active-active replication?

HardLinkedIn
5

What replication lag would you tolerate for a payment system vs a notification system?

HardUber

Ask Aria about Multi-Datacenter Replication (MirrorMaker 2)

Your personal AI tutor — ask anything about this concept

Revision Status

Personal Notes

Sign in to save personal notes for this topic.

Discussion

Sign in to join the discussion.

Loading discussion…