配置无效,从kafka教程启动zookeper时异常退出

zpqajqem  于 2021-06-07  发布在  Kafka
关注(0)|答案(5)|浏览(630)

我跟着这个教程试着设置Kafka,
https://kafka.apache.org/quickstart
当我在zookeeper上做这个角色的时候,我得到了这个错误。这当然与配置有关,但我不知道到什么程度。

bin/zookeeper-server-start.sh config/server.properties
[2018-03-17 03:27:11,623] INFO Reading configuration from: config/server.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2018-03-17 03:27:11,628] ERROR Invalid config, exiting abnormally (org.apache.zookeeper.server.quorum.QuorumPeerMain)
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing config/server.properties
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:154)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Caused by: java.lang.NumberFormatException: For input string: "initial.rebalance.delay.ms"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:589)
    at java.lang.Long.parseLong(Long.java:631)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:242)
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:150)
    ... 2 more
Invalid config, exiting abnormally
wi3ka0sx

wi3ka0sx1#

尝试删除config/,并直接使用该文件。
例如
bin/zookeeper-server-start.sh zookeeper.properties文件

dxxyhpgq

dxxyhpgq2#

您正在使用以下命令启动zookeeper:

bin/zookeeper-server-start.sh config/server.properties

zookeeper配置设置位于zookeeper.properties文件中。所以,要启动zookeeper:

bin/zookeeper-server-start.sh config/zookeeper.properties

对于启动kafka服务器:

bin/kafka-server-start.sh config/server.properties

记住哪个文件随哪个服务器而来。

jq6vz3qz

jq6vz3qz3#

我用下面的方法把这个固定在Windows上。
确保指定完整路径。
首先,去医院 bin\windows Kafka安装文件夹:

C:\kafka_2.12-2.0.0\bin\windows

然后,运行以下命令:

.\zookeeper-server-start.bat C:\kafka_2.12-2.0.0\config\zookeeper.properties

完成后,您将看到以下输出:

[2020-07-06 20:25:13,703] INFO Server environment:user.dir=C:\kafka_2.12-2.0.0\bin\windows (org.apache.zookeeper.server.ZooKeeperServer)
[2020-07-06 20:25:13,716] INFO tickTime set to 3000 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-07-06 20:25:13,717] INFO minSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-07-06 20:25:13,717] INFO maxSessionTimeout set to -1 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-07-06 20:25:13,787] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
[2020-07-06 20:25:13,791] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
w8f9ii69

w8f9ii694#

如果仔细观察,您会注意到启动zookeeper的命令是:

bin/zookeeper-server-start.sh config/zookeeper.properties

使用 zookeeper.properties 文件。
看起来您复制了启动kafka的命令,该命令正在使用 server.properties .

zy1mlcev

zy1mlcev5#

我面临着同样的问题,因为我直接在终端中发出step2命令,这是错误的。我们必须在kafka文件夹中运行step2命令。按照以下步骤成功运行zookeeper。
第1步:转到你的Kafka文件夹或简单地做cd$kafka\u主页
步骤2:bin/zookeeper-server-start.sh./config/zookeeper.properties

相关问题