On this page
Kafka guide · Multi-DC and DR
Stretched cluster over two and a half data centers
A 2.5-DC cluster stretches one Kafka cluster over two data centers that run brokers and a third location that runs only a KRaft controller, so the controller quorum keeps a majority whichever data center is lost. In Apache Kafka, min.insync.replicas then decides whether losing a data center stops acks=all writes or lets them rest on one site. Confluent Server adds observers and automatic observer promotion, which can keep writes going after a site loss without lowering that setting, provided each site holds enough replicas and observers to reach it.
Why half a data center
The KRaft controllers stay available only while a majority of them is alive, and withstanding N concurrent failures takes 2N + 1 controllers. Two sites cannot hold that evenly: with one controller in each, losing either loses the majority. Confluent’s docs say a two-datacenter deployment needs either a preferred datacenter that wins all leader elections, such as a 3:2 split of the KRaft nodes, or manual reconfiguration of the quorum during a network partition; with 3:2, losing the site with three loses the quorum.
The half site removes that choice. Confluent describes the common deployment as two datacenters, each with a KRaft controller and a broker, and a third location that hosts only a controller so that a quorum can be established; its architecture section shows the same idea with five KRaft nodes split two, two and one, and says brokers do not need to be in every datacenter. Losing either data center then leaves a majority, two of three controllers or three of five, and the third location stores no topic data, so it needs no broker capacity. The controller-only site is plain Apache Kafka; what follows splits into what Apache Kafka does with the two data sites and what Confluent Server adds.
In the simulator
- 2-DC freezeTwo sites with one controller each and no third: a split leaves neither side a majority, and leader election stays frozen until the network heals.
- Losing a whole DCThe same two sites with a controller-only third: losing the data center that holds the leader keeps a 2-of-3 controller majority, and leadership moves to the other site.
Apache Kafka: what min.insync.replicas decides
Set broker.rack on each broker to its data center, and give the two sites the same number of brokers: Kafka spreads each partition over min(racks, replication factor) racks, and with uneven racks the side with fewer brokers gets more replicas. A replication factor of 4 then spans both sites; the docs promise the span, not an even split, so check that each partition has two replicas in each.
With two replicas per site, min.insync.replicas sets the trade-off. At 3, an acks=all write needs at least three in-sync replicas, so every acknowledged record is in both sites, but losing a site leaves two, and acks=all producers get NotEnoughReplicas until it returns. At 2, writes go on from the surviving site, but the guarantee weakens: once the ISR has shrunk to one site’s two replicas, because the other site is down, slow or cut off, every write acknowledged in that state is held in one site only. Either way, a write is committed only when every replica in the ISR has it, so while the ISR spans both sites every acks=all write waits for the round trip between them.
When the leader’s data center is lost, the controller elects a new leader from the in-sync replicas left in the other site, which needs the controller majority the third site provides. With unclean.leader.election.enable at its default false, Kafka does not elect a replica that may lack committed records.
In the simulator
- Stretched cluster across 2 DCsRF=4, two replicas per data center,
min.insync.replicas=2: losing the follower site leaves two in-sync replicas, and a new write still commits from one site. - Losing a whole DCLosing the leader’s site: the third site’s controller keeps the quorum, and the surviving site’s in-sync replicas let the controller elect a new leader.
Confluent Multi-Region Clusters: observers
Observers, replica placement constraints and automatic observer promotion are Confluent Server features, part of Multi-Region Clusters. An observer replicates from the leader like a follower but does not join the ISR by default, so an acks=all producer is not held up waiting for it; with follower fetching, consumers can read from observers too. That lets a topic replicate synchronously within one region and asynchronously between regions, and such a topic’s remote copy can trail, so its RPO for a site loss is not zero.
Placement is a JSON policy given with --replica-placement on kafka-topics, stored as confluent.placement.constraints: replicas lists the constraints for the synchronous replicas and observers those for the observers, each by broker.rack. Confluent’s second example fits the two data sites of this layout: version 2, two synchronous replicas and one observer in each of two racks, and observerPromotionPolicy set to under-min-isr. Changing an existing topic’s constraint does not move its partitions; Auto Data Balancer or Self-Balancing has to.
Automatic observer promotion needs placement version 2. With under-min-isr, the default, observers are promoted into the ISR when it drops below min.insync.replicas; with under-replicated, when it drops below the count of replicas in the placement policy; with leader-is-observer, only when you intervene. Once the followers have caught up and rejoined the ISR, the observers are demoted again. When every synchronous replica of a partition is offline, electing an observer that is not in the ISR is an unclean leader election, which can truncate the log to before the last acknowledged offset; Confluent advises watching observer replication so it does not fall too far behind.
In the simulator
- Stretched 2.5-DCTwo synchronous replicas and one observer per data center,
min.insync.replicas=3: cut one site away and the surviving site’s observer is promoted into the ISR. - MRC observersSynchronous replicas in one data center, an observer in the other: writes commit locally while the observer trails.
- Observer promotion needs a reachable leaderUneven placement: losing the site without the leader is survivable, losing the leader’s site leaves too few replicas even after promotion.
- Durability vs latency placementTwo topics on one cluster: a synchronous replica in each site waits for the remote site on every write; a local replica plus a remote observer is fast and risks the last writes.
When the brokers split and the controllers do not
Confluent names one failure its automatic promotion does not handle. In the two datacenters plus controller-only location deployment, if the network partitions the brokers but not the controllers, manual action is needed to restore the cluster to health, even with automatic observer promotion. Its advice is to know that scenario and set up monitoring, alerting and procedures for it. Not every split falls on a site boundary either: a link that fails inside one data center cuts off only the brokers behind it.
In the simulator
- Intra-DC partition splitA link fails inside one data center: the cut-off broker drops out of the ISR, which falls to exactly
min.insync.replicas, so writes go on with no observer promoted.
Sources
- Apache Kafka 4.3 docs, KRaft: deploying considerations
- Confluent Platform docs, Configure Multi-Region Clusters
- Apache Kafka 4.3 docs, Balancing replicas across racks
- Apache Kafka 4.3 docs, topic config min.insync.replicas
- Apache Kafka 4.3 docs, Design: Replication
- Apache Kafka 4.3 docs, topic config unclean.leader.election.enable
Changes to this page
- First published: why the third site, the Apache Kafka trade-off, Confluent observers and promotion, and a split the controllers do not see.