我已经下载了适用于Windows的kafka 2.4.0二进制文件。 当我使用server.properties文件使用kafka-server-start.bat从命令行启动kafka时,出现以下错误:
appsettings.json -> Logging
从Zookeeper日志中,我得到以下错误:
[2020-02-04 15:37:33,775] WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (host.docker.internal/10.177.172.141:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-02-04 15:37:34,931] WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (host.docker.internal/10.177.172.141:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-02-04 15:37:36,122] WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (host.docker.internal/10.177.172.141:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-02-04 15:37:37,364] WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (host.docker.internal/10.177.172.141:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-02-04 15:37:38,692] WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (host.docker.internal/10.177.172.141:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
我已安装docker,但未运行。 server.properties文件未更改。 我无法理解和调试为什么连接到“ host.docker.internal”。
注意:Kafka成功运行了一次。我记得当kafka运行时我强制关闭了Windows。我不知道这是否可能是问题。 我尝试了较低版本的kafka,但仍然遇到相同的错误。
答案 0 :(得分:1)
为什么要连接到“ host.docker.internal
您的Windows Hosts文件很可能已使用该属性更新。
您需要编辑server.properties
才能使用
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://127.0.0.1:9092
答案 1 :(得分:0)
Windows Hosts文件对我来说不太好。