windows - 无法在本地机器上启动 kafka
问题描述
我已经下载了适用于 Windows 的 kafka 2.4.0 二进制文件。当我使用 server.properties 文件使用 kafka-server-start.bat 从命令行启动 kafka 时,出现以下错误:
[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)
从 Zookeeper 日志我得到这些错误:
[2020-02-04 15:37:23,056] INFO Client attempting to establish new session at /127.0.0.1:51457 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-02-04 15:37:23,071] INFO Established session 0x100000298ee0000 with negotiated timeout 6000 for client /127.0.0.1:51457 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-02-04 15:37:23,198] INFO Got user-level KeeperException when processing sessionid:0x100000298ee0000 type:create cxid:0x1 zxid:0x12c txntype:-1 reqpath:n/a Error Path:/consumers Error:KeeperErrorCode = NodeExists for /consumers (org.apache.zookeeper.server.PrepRequestProcessor)
[2020-02-04 15:37:23,214] INFO Got user-level KeeperException when processing sessionid:0x100000298ee0000 type:create cxid:0x2 zxid:0x12d txntype:-1 reqpath:n/a Error Path:/brokers/ids Error:KeeperErrorCode = NodeExists for /brokers/ids (org.apache.zookeeper.server.PrepRequestProcessor)
[2020-02-04 15:37:23,230] INFO Got user-level KeeperException when processing sessionid:0x100000298ee0000 type:create cxid:0x3 zxid:0x12e txntype:-1 reqpath:n/a Error Path:/brokers/topics Error:KeeperErrorCode = NodeExists for /brokers/topics (org.apache.zookeeper.server.PrepRequestProcessor)
我安装了 docker,但它没有运行。server.properties 文件保持不变。我无法理解和调试它为什么连接到“host.docker.internal”。
注意:Kafka 成功运行过一次。我记得我在运行 kafka 时强制关闭了 Windows。我不知道这是否是问题。我尝试了较低版本的kafka,我仍然得到同样的错误。
解决方案
为什么它连接到“host.docker.internal
很可能,您的 Windows 主机文件已使用该属性进行了更新。
您需要编辑您server.properties
的使用
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://127.0.0.1:9092
推荐阅读
- angular - 从沙盒解决方案到 SharePoint 2013 站点的 REST 调用与 JSOM 调用
- python-3.x - 如何重写这个递归函数来生成一个有yield的生成器?
- c++ - 错误 C2971 具有非静态存储持续时间的变量不能用作非类型参数
- python - 在进行逻辑回归时,是否有执行逐步向前或向后选择的函数?
- python - 变量作为功能绑定
- javascript - window.opener.location.href 历史在 Firefox 上不起作用
- c# - 将 Selected Combobox 项目转换为小数并将其存储在数据库中
- python - 获取 TypeError:参数 1 必须是 str,而不是在 DB 中搜索时的元组
- python - 如何将数组数组转换为元组数组
- excel - 具有重复项的表之间的关系 (Excel)