无法在 windows 台机器上设置 Apache Zookeeper 和 Kafka

Unable to setup Apache Zookeeper and Kafka on windows machine

我对 Apache Zookeeper 和 Kafka 还很陌生。我已经在 windows 机器上下载了下面的内容。

Apache 动物园管理员 - http://zookeeper.apache.org/releases.html

卡夫卡 - https://kafka.apache.org/downloads.html

我不太清楚接下来要执行什么或在哪里进行必要的更改。

我去了 C:\apache-zookeeper-3.6.0\bin 并执行了 zkServer.bat 文件

C:\apache-zookeeper-3.6.0\bin>call "C:\Program Files\Java\jdk1.8.0_151"\bin\java "-Dzookeeper.log.dir=C:\apache-zookeeper-3.6.0\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-pc-server-DESKTOP-NQ639DU.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "C:\apache-zookeeper-3.6.0\bin\..\build\classes;C:\apache-zookeeper-3.6.0\bin\..\build\lib\*;C:\apache-zookeeper-3.6.0\bin\..\*;C:\apache-zookeeper-3.6.0\bin\..\lib\*;C:\apache-zookeeper-3.6.0\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "C:\apache-zookeeper-3.6.0\bin\..\conf\zoo.cfg"
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

C:\apache-zookeeper-3.6.0\bin>endlocal

Kafka 的位置:C:\kafka_2.11-2.3.1\bin\windows

C:\kafka_2.11-2.3.1\bin\windows>kafka-server-start.bat
USAGE: kafka-server-start.bat server.properties

C:\kafka_2.11-2.3.1\bin\windows>

我已将 ZOOKEEPER_HOME=C:\apache-zookeeper-3.6.0 和路径设置为 C:\apache-zookeeper-3.6.0/bin

我看了这个视频 https://www.youtube.com/watch?v=TTsOoQ6_QB0,它解决了我的问题。

Apache 动物园管理员:

C:\kafka_2.11-2.3.1 我的 Kafka 发行版所在的位置创建 zookeeper_data(您可以选择任何名称)。

然后转到 C:\kafka_2.11-2.3.1\config 并编辑 zookeeper.properties 文件并使用 dataDir=C:\kafka_2.11-2.3.1\zookeeper_data

启动 Zookeeper 的步骤:

zookeeper-server-start.bat C:\kafka_2.11-2.3.1\config\zookeeper.properties

阿帕奇卡夫卡:C:\kafka_2.11-2.3.1 下创建 kafka-logs 文件夹,然后 转到 C:\kafka_2.11-2.3.1\config 并编辑 server.properties 文件并使用下面的

# A comma separated list of directories under which to store log files
log.dirs=C:\kafka_2.11-2.3.1\kafka-logs

############################# Internal Topic Settings  #############################
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
# For anything other than development testing, a value greater than 1 is recommended for to ensure availability such as 3.
offsets.topic.num.partitions=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
min.insync.replicas=1
default.replication.factor=1

启动 Apache Kafka 的步骤

kafka-server-start.bat C:\kafka_2.11-2.3.1\config\server.properties