Kafka Under-Replicated Partitions
Under-replication reduces fault tolerance even while the partition remains available.
Scope the Incident
Section titled “Scope the Incident”kafka-topics.sh --bootstrap-server kafka:9092 \ --describe --under-replicated-partitions
kafka-log-dirs.sh --bootstrap-server kafka:9092 \ --describe --broker-list 1,2,3
kafka-reassign-partitions.sh --bootstrap-server kafka:9092 --listGroup affected replicas by follower broker, leader broker, log directory, rack, and topic. A cluster-wide pattern suggests shared load or network trouble; one broker or disk suggests a local fault.
Diagnose
Section titled “Diagnose”Check:
- broker restarts, fencing, registration, and failed directories;
- replica fetch lag and ISR shrink/expand rate;
- disk await/utilization, CPU, network retransmits, and JVM pauses;
- active reassignment and replication throttles;
- record-size alignment between topic/broker limits and
replica.fetch.max.bytes; - hot leaders or partitions that exceed a follower's catch-up capacity.
Compare a slow follower with a healthy follower of the same leader. Repeated ISR flapping is often more damaging than a stable, understood maintenance event.
Recover
Section titled “Recover”- Restore the failed broker, disk, or network path.
- Remove obsolete reassignment throttles after the move completes.
- Reassign replicas away from a permanently unhealthy directory or broker.
- Reduce incoming load or rebalance hot leaders when resource saturation prevents catch-up.
- Correct size-limit mismatches before retrying the affected traffic.
Warning
Lowering min.insync.replicas does not repair replication. It permits writes with fewer durable copies and must be treated as an explicit temporary risk decision.
Verify
Section titled “Verify”Watch the follower offset approach the leader, ISR expand, under-replication reach zero, and replication/network/disk metrics return to baseline. Ensure the condition stays healthy after normal traffic resumes.
Prevent Recurrence
Section titled “Prevent Recurrence”Capacity-plan replication traffic, spread leaders and replicas, baseline catch-up time, alert on sustained under-replication and ISR flapping, and test record-size changes end to end.