---
title: "Kafka active-active: two live clusters, mirrored both ways"
description: "How active-active Kafka works: the topic naming that keeps copies out of a loop, consumers that read both regions, key order, and losing a region."
url: https://monedula.dev/kafka/multi-dc/active-active/
---

# Active-active: both clusters take writes and mirror each other

Checked against its sources on 29 November 2026.

In active-active, producers write to a Kafka cluster in each region and each cluster mirrors the topics written there to the other, so both end up with every record. In the usual layout, with MirrorMaker 2 or a prefixed cluster link, each region writes a topic of its own and receives the other region’s under a different name, which keeps records from two clusters out of one partition and the copies out of a loop; Replicator and Lenses K2K can keep the same names and stop loops with a header instead. Losing a region means moving its clients to the survivor rather than promoting a standby, and the records it had not yet copied are the RPO.

## One writable topic per region

Data for any one topic is copied in one direction, so active-active means copying each way: MirrorMaker 2 needs both flows enabled (`us-west->us-east.enabled = true` and `us-east->us-west.enabled = true` in the Apache Kafka docs’ example). What keeps the two flows apart is naming. MirrorMaker 2 renames each copy by its replication policy, by default `{source}.{source_topic_name}`, to ensure that records from different clusters are not written to the same topic-partition: `orders` written in `us-west` arrives in `us-east` as `us-west.orders`, and the other way round. The separator is `replication.policy.separator` and the whole scheme a pluggable `replication.policy.class`. On loops, the docs say that as long as both flows are defined in the same MirrorMaker configuration file, no `topics.exclude` settings are needed to prevent replication loops between the two clusters.

Cluster Linking does it with a link in bidirectional mode between each pair of clusters: one link for two clusters, three for three. The mode cannot be changed after the link is created. For each topic data still flows one way, from the source topic to its mirror. Confluent recommends giving the writable topics the same name in every region, which then requires `cluster.link.prefix` on both clusters, so that mirror topics do not clash with the writable ones, and a distinct prefix on each, such as the region name followed by a delimiter, so that mirror topics do not clash with one another. The alternative it names is to put the region in the writable topic’s name, which makes producers pick the topic for the region they write to. A prefix on a data link disables ACL sync on it; ACLs then need a dedicated link of their own.

Replicator protects against circular replication with provenance headers: with one instance copying each way, records it copied into a datacenter are not copied back, and it can keep the same topic names on both sides. The headers are off by default (`provenance.header.enable`). Lenses K2K’s bidirectional replication is a licensed feature, disabled by default: each direction runs its own pipeline, which marks the records it copies with a header (`__k2k_bidirectional` by default) and skips records that already carry it. Apache Kafka’s Cluster Mirroring (KIP-1279, accepted, not yet released) does not support active-active at first: it mirrors in both directions only for different topics, and if it detects the same topic mirrored back it moves those partitions to a failed state.

- Simulator: [Active-active multi-cluster](https://monedula.dev/kafka-simulator/scenarios/active-active/): Each region writes a topic named after it, `west.orders` or `east.orders`, and the simulator copies it to the other region under the same name; the copy is read-only there, and each link copies only its own region’s topic, so nothing is copied back.
- Simulator: [Cluster Linking vs MirrorMaker 2: when to use which](https://monedula.dev/kafka-simulator/scenarios/cluster-linking-vs-mm2/): The naming difference side by side: a cluster link’s mirror keeps the topic name, MirrorMaker 2’s copy carries the source cluster’s prefix.

## Consumers read both regions

With a topic per region, a consumer that needs every record reads more than one topic. KIP-382 describes it for MirrorMaker 2: subscribe to the local topic and all its remote copies, such as `topic1`, `us-west.topic1` and `us-east.topic1`, or use a regex subscription; MirrorMaker 2 never merges topics, so the merging is left to the consumer, which can also choose not to aggregate by subscribing to the local topic only. Confluent’s active-active guide describes both a topic list and a pattern, its prerequisites require a pattern, and it prefers a narrow one such as `^([a-z0-9-]*\.)?orders$` over `.*orders`, which would also match topics like `east.private.orders`. A pattern also picks up the topic of a region added later.

Order changes. Within one topic all records with a key go to one partition and every consumer group reads them in the same order. With two writable topics, a record for key K written in one region and another for K written in the other sit in different partitions, and Kafka does not guarantee order across partitions, so two consumer groups can read them in opposite orders. Replicator’s docs say the same for same-named topics written in two datacenters: it provides no global ordering. Confluent’s suggestion for a group that depends on order is the record timestamp, set when the record is first produced and kept by Cluster Linking: track the latest timestamp seen per key across the whole group, and ignore or specially handle a record older than that. Confluent also says an active-active setup requires careful management of data consistency and conflict resolution.

A consumer group consumes from one cluster at a time, and moving it means shutting it down in one region before starting it in the other. For its offsets to follow it, Cluster Linking needs consumer offset sync (`consumer.offset.sync.enable`, default `false`) enabled on both clusters’ link objects, after which offsets flow in both directions, and group names must be globally unique. MirrorMaker 2 writes translated offsets to the target only with `sync.group.offsets.enabled=true` (default `false`), and only while no consumer of that group is connected there. Replicator’s docs add a warning: groups with the same ID in each datacenter reading same-named topics reprocess the same records in each datacenter.

- Simulator: [Active-active multi-cluster](https://monedula.dev/kafka-simulator/scenarios/active-active/): A consumer group in each region subscribes to both topics and reads the whole stream; a cut between the regions stalls both mirrors while local reads and writes go on.

## Losing a region

There is nothing to promote: the survivor already takes writes. Confluent’s steps are to shut down any producers and consumers still running in the failed region and restart them in the surviving one, and not to call `failover` on the mirror topics or delete the cluster links, so that mirroring can deliver the lost region’s data later. A producer always writes the writable topic of the region it is connected to, so a moved producer writes the survivor’s; with the same name in every region, its topic setting does not change. Confluent Cloud’s Automatic Failover does not support active-active, so redirecting clients is done at the application or DNS level; Confluent asks for clients that fetch their bootstrap address and credentials from a service discovery tool or secret manager, and says Kafka has no built-in way to make running clients restart against the other cluster. Each region needs the capacity to take the other’s load: Confluent advises sizing all clusters identically.

The RPO is the lost region’s outbound lag: records it acknowledged and had not copied are not on the survivor. Consumer groups that move resume at their last synced or translated offset, so they read again what they committed after it: Cluster Linking syncs offsets every `consumer.offset.sync.ms`, 30 seconds by default, and MirrorMaker 2 checkpoints every 60 seconds by default (`emit.checkpoints.interval.seconds`) and syncs group offsets at the same default interval (`sync.group.offsets.interval.seconds`). The consumer offsets page in this area works through where each tool resumes a group.

- Simulator: [Active-active DR drill](https://monedula.dev/kafka-simulator/scenarios/active-active-dr-drill/): West is lost with one record inside the mirror lag; its producer and consumer group move to east, the producer writes east’s own topic, and the stranded record is the RPO.

## When the region comes back

A region that returns with its disks still has the records it never copied. With Cluster Linking the links left in place resume and stream them to the other cluster’s mirror topics, and on to its consumer groups; pausing those mirror topics lets you choose when that happens. The same links bring the recovered cluster everything written to the survivor during the outage. Those late records arrive after records the survivor took later, which is one more reason the ordering above cannot rest on offsets alone. If the region’s data is gone, so are its uncopied records.

Failing back is moving clients again, one producer at a time if you like, since both sides stay writable. Confluent warns that consumer groups can read duplicates during failback if their offsets are clamped, and lists two conditions to meet first: the mirror topic’s lag is zero or smaller than the group’s lag, and at least one `consumer.offset.sync.ms` interval has passed since the group last committed. The Apache Kafka docs read for this page describe no procedure for a region’s return under MirrorMaker 2. In the simulator, the mirror out of the returning region resumes where it stopped and delivers the stranded records late.

- Simulator: [Active-active DR drill](https://monedula.dev/kafka-simulator/scenarios/active-active-dr-drill/): West restarts with the stranded record still on disk; the simulator’s mirror copies it to east late, and west’s producer and consumer group move back home.

## Sources

- [Apache Kafka 4.3 docs, Geo-Replication (Cross-Cluster Data Mirroring)](https://kafka.apache.org/43/operations/geo-replication-cross-cluster-data-mirroring/)
- [Apache Kafka 4.3 docs, MirrorMaker configs](https://kafka.apache.org/43/configuration/mirrormaker-configs/#mirror_checkpoint_emit.checkpoints.interval.seconds)
- [KIP-382: MirrorMaker 2.0](https://cwiki.apache.org/confluence/display/KAFKA/KIP-382%3A+MirrorMaker+2.0)
- [Confluent Cloud docs, Cluster Linking manual switchover for active-active DR](https://docs.confluent.io/cloud/current/multi-cloud/cluster-linking/dr-manual-switch-active-active.html)
- [Confluent Platform docs, Replicator overview](https://docs.confluent.io/platform/current/multi-dc-deployments/replicator/index.html)
- [Confluent Platform docs, Replicator configuration reference, provenance.header.enable](https://docs.confluent.io/platform/current/multi-dc-deployments/replicator/configuration_options.html)
- [Lenses K2K docs, bidirectional replication](https://docs.lenses.io/latest/k2k/configuration-reference/bidirectional-replication.md)
- [KIP-1279: Cluster Mirroring (status Accepted)](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1279%3A+Cluster+Mirroring)

## Changes to this page

- 29 November 2026: First published: the topic layout each tool uses, consumers and ordering across two regions, losing a region and its return.
