Explain how Kafka MirrorMaker works and its use cases in cross-data center replication.

Instruction: Discuss the architecture, functionality, and real-world application scenarios of Kafka MirrorMaker.

Context: This question tests the candidate's knowledge of Kafka's cross-data center replication capabilities and their ability to implement and manage such setups.

Updated

Official answer

MirrorMaker 2 replicates selected data between independent Kafka clusters using Kafka Connect. It is distinct from the replicas of a partition inside one cluster.

A replication flow consumes from a source cluster and produces to a target. The source connector copies records and maintains offset-sync information; the checkpoint connector translates consumer-group progress, and heartbeat records help observe connectivity. Source and target offsets are not interchangeable numbers. Configuration controls topic/group selection, naming, supported configuration/ACL synchronization and checkpoint behavior.

Typical uses are disaster recovery, a cluster migration, and combining regional streams for analytics. In an active/passive design, applications normally use the primary cluster while the standby receives mirrored data. Default remote-topic naming includes the source alias; applications and failover procedures must account for that policy.

Replication is asynchronous. Monitor record age, replication latency, checkpoint freshness and task failures. A source outage can occur before its latest records reach the target, so define a measurable recovery point objective. Any exactly-once replication option has configuration and version requirements and does not make two clusters a synchronous atomic system.

For failover, fence or stop the old writers, verify which records and translated offsets are available, configure target applications, and handle replay/idempotency. Prevent competing writers and replication loops when designing bidirectional flows. Rehearse failback as well as failover; a recovered primary is not automatically authoritative.

Secure both connections and the target data. Mirroring does not itself prove zero loss, zero downtime or compliance with residency rules.

MirrorMaker architecture and flows, connector configuration

Related Questions