安装教程
问题
在生产消息时,发生如下问题:
WARN Error while fetching metadata with correlation id 1 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
controller.log日志如下:
[2018-11-08 10:26:48,704] WARN [Controller-0-to-broker-0-send-thread], Controller 0's connection to broker 222.221.5.253:9092 (id: 0 rack: null) was unsuccessful (kafka.controller.RequestSendThread)
java.net.SocketTimeoutException: Failed to connect within 30000 ms
at kafka.controller.RequestSendThread.brokerReady(ControllerChannelManager.scala:233)
at kafka.controller.RequestSendThread.liftedTree1$1(ControllerChannelManager.scala:185)
at kafka.controller.RequestSendThread.doWork(ControllerChannelManager.scala:184)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:63)
解决
修改配置文件config/server.properties
后重新启动zookeeper和kafka即可。
修改配置如下:
#原配置:listeners=PLAINTEXT://:9092
listeners=PLAINTEXT://localhost:9092