Monedula

Scenario 25.1.7 · SR across two DCs: losing the leader's DC

Schema Registry across two DCs: losing the leader DC

Schema registry · Advanced · about 5 min · Apache Kafka 4.4 · Confluent Platform feature

SR runs in both DCs but only dc-a may lead. Lose dc-a and dc-b still serves lookups, while a new schema version cannot be registered.

Run this scenario in the playground

a new schema cannot register. t+3.100s

p1 is redeployed with schema v2. Registering it needs a leader, none can be elected in dc-b, and the serializer fails. Old schemas keep flowing; new ones wait for dc-a.

Open at this step: step 5, a new schema cannot register

What you start with

A stretched cluster has one _schemas topic, so all SR instances form one group with one leader. Here sr-1 and sr-2 in dc-a are leader-eligible; sr-3 in dc-b runs with leader.eligibility=false, a common setup that keeps the leader near the primary DC.

Step by step

  1. SR in both DCs · only dc-a may lead t+0.000s One stretched cluster, one _schemas topic. sr-1 and sr-2 in dc-a are leader-eligible; sr-3 in dc-b runs with leader.eligibility=false. The clients run in dc-b. The Setup review flags the eligibility. Open at this step: step 1, SR in both DCs · only dc-a may lead
  2. O1 written and read t+1.000s Warm clients in dc-b, no SR calls. Open at this step: step 2, O1 written and read
  3. dc-a lost t+1.300s dc-a goes down with its brokers and sr-1, sr-2. sr-3 survives but may not lead: the registry has no leader. orders keeps a leader in dc-b. Open at this step: step 3, dc-a lost
  4. lookups still work in dc-b t+2.400s c1 restarted with an empty cache. It looks up schema id 1 on sr-3, a follower can answer that, and reads O2. Open at this step: step 4, lookups still work in dc-b
  5. a new schema cannot register t+3.100s p1 is redeployed with schema v2. Registering it needs a leader, none can be elected in dc-b, and the serializer fails. Old schemas keep flowing; new ones wait for dc-a. Open at this step: step 5, a new schema cannot register
  6. sr-3 leads, _schemas refuses t+3.800s sr-3 is reconfigured with leader.eligibility=true and wins the election in dc-b. The deploy still fails: _schemas kept two of its three replicas in dc-a, so its ISR is one broker, below min.insync.replicas 2, and the leader cannot write the new schema. Open at this step: step 6, sr-3 leads, _schemas refuses

The takeaway

After a DC loss SR lookups survive wherever an instance survives, but registrations need a leader-eligible instance that reaches a writable _schemas. Making sr-3 eligible gives dc-b a leader, yet _schemas kept two of its three replicas in dc-a and now sits below min.insync.replicas. Give every DC that must keep deploying schemas leader-eligible instances, and place _schemas replicas so a DC loss keeps min.insync.replicas.

Configs in this scenario

  • min.insync.replicas The fewest in-sync replicas, leader included, that must have a write for an acks=all produce to succeed (default 1); with fewer in the ISR the leader rejects the write with NOT_ENOUGH_REPLICAS. How min.insync.replicas works

Embed this scenario

Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.

<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=25.1.7" title="Kafka Simulator: SR across two DCs: losing the leader's DC" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/sr-stretched-dc-loss/">Schema Registry across two DCs: losing the leader DC</a></p>

Further reading

Confluent documentation

Troubleshooting

More in Schema registry

All scenarios