kafka
runtime_error
ai_generated
true
分区未找到异常:此服务器不托管该分区
org.apache.kafka.common.errors.PartitionNotFoundException: This server does not host this partition
ID: kafka/partition-not-found
78%修复率
84%置信度
1证据数
2024-05-12首次发现
根因分析
客户端请求的目标分区不在该代理上托管,通常由于元数据过时或分区重新分配。
English
Client request targets a partition that is not hosted on the broker, often due to stale metadata or partition reassignment.
官方文档
https://kafka.apache.org/documentation/#partition_reassignment解决方案
-
通过设置 metadata.max.age.ms 为较低值强制刷新元数据,例如 props.put("metadata.max.age.ms", "5000"); -
等待分区重新分配完成并检查状态:kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --verify --reassignment-json-file reassign.json
-
重启客户端以强制从代理获取新的元数据。
无效尝试
常见但无效的做法:
-
95% 失败
Manually deleting the partition metadata can lead to data loss and inconsistency.
-
90% 失败
Ignoring the error and retrying without refreshing metadata will keep failing.