如何在本地机器上设置 kafka 和 zookeeper?

How to setup kafka and zookeeper on your local machine?

我已经在我的本地 C:\ 驱动器文件夹上安装了 kafka 和 zookeeper 现在我正在尝试 运行 zookeeper 和 kafka 服务器所以我可以创建主题但是它抛出以下错误,不知道发生了什么这里错了吗?

kafka 命令行:

C:\kafka_2.11-0.10.0.0>.\bin\windows\kafka-server-start.bat .\config\server.pro
erties
'#' is not recognized as an internal or external command,
operable program or batch file.
The syntax of the command is incorrect.
Error: missing `server' JVM at `C:\Program Files (x86)\Java\jre8\bin\server\jvm
dll'.
Please install or use the JRE or JDK that contains these missing components.

zookeeper.config

tickTime=2000
initLimit=10
syncLimit=5
dataDir=\zookeeper-3.4.8
clientPort=2181

你在系统变量里设置了ZOOKEEPER_HOME了吗? 请关注此视频 https://www.youtube.com/watch?v=OJKesEpO6ok

在最新版本kafka_2.12-3.1.0 (2022) 解压缩并设置属性和日志后。将 Kafka 文件夹保留在 C 驱动器上,并始终 运行 命令提示符 'run as administrator'。 您可以使用以下命令配置 zookeeper .bat 文件用于 windows

1 号航站楼动物园管理员

C:\kafka\bin\windows>zookeeper-server-start.bat ..\..\config\zookeeper.properties

终端 2 服务器

C:\kafka\bin\windows>kafka-server-start.bat ..\..\config\server.properties

终端3创建话题

C:\kafka\bin\windows>kafka-topics.bat --create --topic tutorialGB --bootstrap-server localhost:9092

Created topic tutorialGB.

到已创建主题的清单

C:\kafka\bin\windows>kafka-topics.bat --list --bootstrap-server localhost:9092

tutorialGB