简体   繁体   中英

Could not start zookeeper for kafka on windows

I have the following folder structure:

在此处输入图片说明

from C:\\Program Files\\kafka\\kafka_2.11-0.11.0.0 frolder I try to execute following command:

bin\windows\zookeeper-server-start.bat config\zookeeper.properties

and it reponds with following message:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

I tried to use several another variants but I still see errors:

C:\Program Files\kafka\kafka_2.11-0.11.0.0>bin\windows\zookeeper-server-start.bat
USAGE: bin\windows\zookeeper-server-start.bat zookeeper.properties

C:\Program Files\kafka\kafka_2.11-0.11.0.0>bin\windows\zookeeper-server-start.bat C:\Program Files\kafka\kafka_2.11-0.11.0.0\config\zookeeper.properties
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\kafka\kafka_2.11-0.11.0.0>bin\windows\zookeeper-server-start.bat 'C:\Program Files\kafka\kafka_2.11-0.11.0.0\config\zookeeper.properties'
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

What do I wrong?

Paths containing spaces need to be enquoted (ie "C:\\Program Files\\kafka\\" instead of C:\\Program Files\\kafka\\ ).

The simplest solution would be to move your kafka folder to a path which contains no spaces, such as C:\\kafka , and adjust the configuration file accordingly.

Another option would be to edit your configuration files (and possibly the batch files as well) and to enquote the paths which contain spaces.

A third, unrecommended option would be to use the 8.3 path syntax, which means editing the config and batch files to use C:\\Progra~1\\kafka instead of C:\\Program Files\\kafka

你可以试试这个:

bin\windows\zookeeper-server-start.bat .. \ ..\config\zookeeper.properties

I got the same issue when I want to run server. Actually this had happened due to the long path where you had saved your Kafka Folder. Previously I had saved my Kafka folder in User's Directory ("C:\\Users\\xxxx\\xxxx\\kafka_2.13-2.8.0"). So after changing path of my Kafka folder to ("C:") it got solved.

您可以通过在 kafka 文件夹的环境变量中声明路径来解决此问题,例如 C:\\kafka_2.12-2.8.0\\bin\\windows,然后打开一个新终端并尝试运行相同的命令,它有望工作.

You should restart the PC and try again. It gonna work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM