Install Kafka as windows service

2019-05-08 18:48发布

How can I install and run Apache Kafka as windows service? Right now I need to go to command prompt and start zookeeper and kafka server. Is there any way so that I can install Apache Kafka as Windows service?

I saw only below blog but don't know what they mean by "Adjusts the settings for a Windows environment" and "Build the project in Release mode" http://www.lukemerrett.com/2015/12/01/apache-kafka-windows-service-wrapper/

Thanks!

2条回答
时光不老,我们不散
2楼-- · 2019-05-08 19:15

Perform all the pre-requisites and installation steps as specified in:
Setting Up and Running Apache Kafka on Windows OS

Complete all the steps till step 6 of section C.

(i) Use NSSM (a FREE service manager) and enter the below in Path and Arguments, to create a Windows service for ZooKeeper:
Path: <ZooKeeper directory>\bin\windows\zookeeper-server-start.bat
Arguments: <ZooKeeper directory>\config\zookeeper.properties

(ii) Use NSSM (a FREE service manager) and enter the below in Path and Arguments, to create a Windows service for Kafka:
Path: <Kafka directory>\bin\windows\kafka-server-start.bat
Arguments: <Kafka directory>\config\kafka.properties

Provide a dependency of ZooKeeper service (under the Dependencies tab in the NSSM setup of Kafka), so that when you startup Kafka service, ZooKeeper service is automatically started (if it isn't running already).

NB: Please note that ZooKeeper ships with Kafka, and the binaries to start and stop the ZooKeeper service is found in the same <Kafka directory>\bin\windows\ directory.

Hope it explains!

查看更多
手持菜刀,她持情操
3楼-- · 2019-05-08 19:20

If you're interested, there are also some GitHub projects doing this.

There's this one: https://github.com/lukemerrett/Kafka-Windows-Service which also installs ZooKeeper and Kafka for you.

And I also created my own: https://github.com/ngeor/kafka-windows-service-wrapper which doesn't install anything, merely acts as a wrapper. It also tries to be a bit smart regarding race conditions when restarting ZooKeeper and Kafka too fast.

查看更多
登录 后发表回答