Quick revision
The short answer
We start a new instance with the same node.id and configuration, format its empty disks with kafka-storage.sh format using the existing cluster id, and start it; it rejoins as a follower for all its old partitions and copies everything from the leaders. At 200 MB/s, 6 TB takes about 30,000 seconds, a little over eight hours, so we set replication throttles to protect client latency. Until it catches up, those partitions have only two in-sync replicas, so one more broker failure would block acks=all producers, and we avoid any other maintenance and watch UnderReplicatedPartitions.
What to remember
In this answer, we saw that a broker in KRaft is identified by its node.id, so the fastest replacement is a new instance with the same id and configuration, its disks formatted with the existing cluster id, which then refetches its partitions from the leaders. With 6 TB at 200 MB/s that takes a little over eight hours, and replication throttles keep client latency steady while it runs. During that window the affected partitions have only two in-sync replicas, so we avoid other maintenance and watch the replication metrics, and we plan capacity or storage design so the next instance loss is less painful.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We start a new instance with the same node.id and configuration, format its empty disks with kafka-storage.sh format using the existing cluster id, and start it; it rejoins as a follower for all its old partitions and copies everything from the leaders. At 200 MB/s, 6 TB takes about 30,000 seconds, a little over eight hours, so we set replication throttles to protect client latency. Until it catches up, those partitions have only two in-sync replicas, so one more broker failure would block acks=all producers, and we avoid any other maintenance and watch UnderReplicatedPartitions.
Why this question is asked
Local NVMe disks are fast and cheap, which is why many teams run Kafka on them. The price is that the disks vanish with the instance, and cloud providers retire instances on their own schedule. Interviewers ask this scenario because it tests practical KRaft operations, simple capacity arithmetic, and awareness of the risk window that every rebuild opens. In this answer, we will see how a broker identity works in KRaft, walk through replacing the broker, estimate how long re-replication takes, keep it from hurting clients with throttles, and finally look at the risk during the rebuild and how to plan for the next one.
1A Quick Recap: What Identifies a Broker in KRaft
In KRaft mode, the only mode in Kafka 4, a small group of controller nodes holds the cluster metadata in a replicated log of its own. That metadata says, for every partition, which broker ids hold its replicas. The replica list for a partition might be [3, 7, 11], meaning brokers with node.id 3, 7 and 11.
So the assignment is tied to the broker id, not to the machine. When the instance behind broker 7 disappears, the metadata still lists 7 as a replica for its partitions; those replicas simply drop out of the ISR, the in-sync replica set, and leadership moves to the surviving replicas. Each broker's log directories also hold a meta.properties file with the cluster id and node id, written when the directory is formatted, and a broker refuses to start on unformatted directories.
2Replacing the Broker With the Same Id
The simplest path is to give the cluster back a broker 7. We launch a new instance with the same configuration: the same node.id, the same listeners and advertised addresses (usually through a DNS name that we repoint), the same broker.rack, and the controller quorum settings. Then we format the empty log directories with the existing cluster id, which we can read from another broker's meta.properties.
- Launch instance with node.id 7same config, rack and DNS name
- Format disks with existing cluster id
kafka-storage.shformat -t <cluster id> - Set replication throttles
- Start broker; it registers with controllers
- Fetch all partitions from leadersabout 8 hours for 6 TB at 200 MB/s
- Partitions rejoin ISR one by one
- Remove throttles; run preferred leader election
7 steps in order. Play them, or step through them one at a time.
When it starts, the broker registers with the controllers, learns from the metadata that it is a replica for its partitions, finds nothing on disk, and starts fetching every partition from its leader from offset zero, or rather from each leader's log start offset. As each partition catches up, it rejoins the ISR, and later the preferred leader election moves leadership back to it where it was the preferred leader.
The alternative is to reassign broker 7's partitions to the other eleven brokers with kafka-reassign-partitions.sh and retire the id. That works, but we would have to generate and review a plan for thousands of partitions, and the same 6 TB must be copied anyway, now onto brokers that are already busy. Reusing the id is simpler because the assignment already exists.
3How Long Re-Replication Takes
Re-replication time is the data volume divided by the rate at which the new broker can pull it. The rate is limited by the slowest of three things: the new broker's network and disk, the leaders' spare network and disk capacity, and any throttle we set. Suppose we decide to let replication use 200 MB/s.
Then 6 TB is 6,000,000 MB, and 6,000,000 / 200 = 30,000 seconds, which is about 8 hours and 20 minutes. Notice that the work is spread over eleven leaders, so each leader only serves about 18 MB/s on average, but the new broker receives the whole 200 MB/s. If the instance has 25 Gbit/s networking, about 3 GB/s in theory, we could go faster, but only by taking capacity from clients.
4Keeping Clients Safe With Replication Throttles
Kafka has a built-in throttle for exactly this. It has two parts. The rates, leader.replication.throttled.rate and follower.replication.throttled.rate, are dynamic broker configs in bytes per second. The replica lists, leader.replication.throttled.replicas and follower.replication.throttled.replicas, are topic configs that say which partition replicas the throttle applies to; the value * means all of them. The throttle only affects replication traffic, so produce and fetch requests from clients keep their full share.
We then watch client produce and fetch latency, the p99 request times on the brokers, and the replication byte rates. If latency holds, we can raise the rate to finish sooner; if it climbs, we lower it. When the broker is fully caught up, we must remove the throttle configs, because a forgotten throttle will slow the next real recovery.
5The Risk While It Runs, and Planning for Next Time
For those eight hours, every partition that had a replica on broker 7 has only two in-sync replicas. With min.insync.replicas=2, that is still enough to write. But if a second broker fails, any partition that had replicas on both broker 7 and the second broker drops to one in-sync replica, and producers using acks=all receive NotEnoughReplicas errors for those partitions. The data is not lost, but writes stop.
So during the rebuild we freeze other maintenance: no rolling restarts, no upgrades, no kernel patches. We watch the UnderReplicatedPartitions metric fall towards zero, along with UnderMinIsrPartitionCount, which should stay at zero, and we alert on any new broker problem straight away.
Finally, we plan for this to happen again, because with local-disk instances every instance loss means a full re-replication. That means keeping network headroom above normal traffic for rebuilds, keeping data per broker small enough that a rebuild fits in an acceptable window, or changing the design: network-attached volumes survive instance replacement, and tiered storage keeps only recent segments on local disk, so there is far less to copy.
6Follow-up questions
Why not just add a thirteenth broker instead of reusing id 7?
A new broker with a new id gets no partitions until we reassign some to it, so the partitions that lost their replica on broker 7 would stay under-replicated until we wrote a reassignment plan anyway. Reusing id 7 restores the third replica for every affected partition with no plan to write, and it keeps the cluster's balance as it was.
How do we know when the rebuild is finished?
UnderReplicatedPartitions returns to zero across the cluster, the new broker's replica lag metrics settle near zero, and kafka-topics.sh --describe --under-replicated-partitions prints nothing. Then we remove the throttle configs and run a preferred leader election so broker 7 takes back its share of leadership.
7Conclusion
In this answer, we saw that a broker in KRaft is identified by its node.id, so the fastest replacement is a new instance with the same id and configuration, its disks formatted with the existing cluster id, which then refetches its partitions from the leaders. With 6 TB at 200 MB/s that takes a little over eight hours, and replication throttles keep client latency steady while it runs. During that window the affected partitions have only two in-sync replicas, so we avoid other maintenance and watch the replication metrics, and we plan capacity or storage design so the next instance loss is less painful.
Open with
I would replace the broker by reusing its identity. I would launch a new instance with the same node.id, listeners, rack and configuration, read the cluster id from another broker's meta.properties, run kafka-storage.sh format with that cluster id on the empty disks, and start it.
Then, if they want more
It registers with the KRaft controllers, sees from the metadata that it is still a replica for its old partitions, and fetches everything from the leaders. Reassigning its partitions elsewhere is possible, but the assignment already exists, so reusing the id is simpler.
For timing, 6 TB at 200 MB/s is about 30,000 seconds, so a bit more than eight hours. To protect clients I would set leader and follower replication throttled rates on the brokers and the throttled-replica lists on the topics, watch p99 produce and fetch latency, and adjust the rate.
The main risk is that for those hours the affected partitions have only two in-sync replicas. If another broker fails, some partitions drop below min.insync.replicas of 2 and acks=all producers stop. So I would freeze other maintenance and watch UnderReplicatedPartitions. Longer term, I would keep network headroom for rebuilds, or reduce data per broker with network volumes or tiered storage.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Describe how you replace the broker, how long re-replication may take, how you keep it...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/18c4ff688d/