kafka
network_error
ai_generated
true
java.io.IOException: 无法连接到节点 -1 (localhost/127.0.0.1:9092)。代理可能不可用。
java.io.IOException: Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.common.errors.TimeoutException)
ID: kafka/network-exception-read-returned-negative
85%修复率
85%置信度
1证据数
2023-04-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kafka 2.8.0 | active | — | — | — |
| Kafka 3.0.0 | active | — | — | — |
| Kafka 3.4.0 | active | — | — | — |
根因分析
Kafka 客户端无法与代理建立 TCP 连接,通常是由于网络配置错误或代理宕机。
English
The Kafka client cannot establish a TCP connection to the broker, often due to network misconfiguration or broker downtime.
官方文档
https://kafka.apache.org/documentation/#broker_not_available解决方案
-
Verify broker availability by running `telnet localhost 9092` or `nc -zv localhost 9092` to ensure the port is open. Then check broker logs for errors.
-
Update `bootstrap.servers` in the producer/consumer configuration to point to a correct, reachable broker list (e.g., `bootstrap.servers=broker1:9092,broker2:9092`).
无效尝试
常见但无效的做法:
-
Restarting the Kafka client without checking broker health
90% 失败
The underlying broker issue (e.g., crash, network partition) remains unresolved, so the error recurs.
-
Increasing `request.timeout.ms` to a very high value
70% 失败
A timeout extension does not fix the connection failure; it only delays the error message.