kafka
runtime_error
ai_generated
partial
org.apache.kafka.common.errors.ReplicaNotAvailableException: Replica for partition is not available
ID: kafka/replica-not-available
85%Fix Rate
84%Confidence
1Evidence
2023-09-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2.8.2 | active | — | — | — |
| 3.2.3 | active | — | — | — |
| 3.5.1 | active | — | — | — |
Root Cause
A follower replica for the requested partition is offline, not fully caught up, or the fetch request targets an unavailable replica.
generic中文
请求的分区的跟随者副本离线、未完全同步,或拉取请求指向了不可用的副本。
Official Documentation
https://kafka.apache.org/documentation/#replicationWorkarounds
-
90% success Check the broker logs for the specific partition and bring the offline replica online: # Identify the partition leader kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my_topic # Restart the broker hosting the unavailable replica or reassign replicas: kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --reassignment-json-file reassign.json --execute
Check the broker logs for the specific partition and bring the offline replica online: # Identify the partition leader kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my_topic # Restart the broker hosting the unavailable replica or reassign replicas: kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --reassignment-json-file reassign.json --execute
-
80% success Set the consumer to read from the leader only by setting client-side rack awareness or using a fetch from the leader (default behavior if replica selector is not configured).
Set the consumer to read from the leader only by setting client-side rack awareness or using a fetch from the leader (default behavior if replica selector is not configured).
中文步骤
Check the broker logs for the specific partition and bring the offline replica online: # Identify the partition leader kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my_topic # Restart the broker hosting the unavailable replica or reassign replicas: kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --reassignment-json-file reassign.json --execute
Set the consumer to read from the leader only by setting client-side rack awareness or using a fetch from the leader (default behavior if replica selector is not configured).
Dead Ends
Common approaches that don't work:
-
95% fail
Restarting the consumer only retries the fetch, but the replica remains unavailable.
-
85% fail
Increasing fetch.max.wait.ms only delays the timeout, not the root cause.