---
title: "Highly available Schema Registry: leader failover"
description: "Three Schema Registry instances elect a leader through a Kafka group. Kill it and a follower takes registrations; kill all three and only warm clients go on."
url: https://monedula.dev/kafka-simulator/scenarios/ha-schema-registry/
---

# Highly available Schema Registry: leader failover

Scenario 25.1.6 · HA Schema Registry: the leader fails over. Schema registry · Advanced · about 4 min · Apache Kafka 4.4 · Confluent Platform feature.

Three SR instances, one leader. Kill it and a follower takes over registrations; kill all three and only warm clients keep going.

Run it: https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6

## What you start with

Schema Registry runs as a cluster: every instance serves lookups from memory, but only the leader writes new schemas to the _schemas topic. The leader is elected through a Kafka consumer group, among the instances with leader.eligibility=true.

## Step by step

1. **three instances · sr-1 leads** (t+0.000s): sr-1, sr-2 and sr-3 joined the schema-registry group on the Kafka cluster; sr-1 won the election and takes registrations. Every instance serves lookups. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6&t=0)
2. **O1 written and read** (t+0.900s): Warm clients, no SR calls. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6&t=1)
3. **sr-1 down · sr-2 leads** (t+1.100s): The leader dies and the group elects sr-2. Lookups never stopped: sr-2 and sr-3 hold the whole registry in memory. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6&t=2)
4. **v2 registered through sr-2** (t+2.000s): p1 is redeployed with schema v2. Its serializer registers it: the request is forwarded to the leader sr-2, which writes it to _schemas as schema id 2. O2 carries id 2 and the consumer looks it up. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6&t=3)
5. **every instance down** (t+2.300s): sr-2 and sr-3 die as well. No leader, no lookups. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6&t=4)
6. **a cold consumer is stuck** (t+3.100s): c1 restarts with an empty cache and stops at O3: nobody can tell it what schema id 2 is. p1, still warm, keeps writing. Several instances protect against one failure, not against all of them. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=25.1.6&t=5)

## The takeaway

Several SR instances keep lookups and registrations alive through one failure: followers forward writes, and a follower takes over when the leader goes. They do not help a client that needs SR while all of them are down.

## Further reading

- [Confluent documentation](https://docs.confluent.io/platform/current/schema-registry/installation/deployment.html)

## Troubleshooting

- [Kafka SerializationException: Schema Registry unreachable](https://monedula.dev/kafka/troubleshooting/schema-registry-unavailable/)
