Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Kafka on Windows?

I'm trying to install Kafka message queue on Windows for testing purposes (not for production).

I found this article on how to install Apache Kafka 0.8 on Windows: http://janschulte.wordpress.com/2013/10/13/apache-kafka-0-8-on-windows/

It's a good article, but it's outdated, unfortunately.

Does someone know a way to achieve that?

like image 638
Yves M. Avatar asked Apr 16 '14 16:04

Yves M.


2 Answers

Ok, it's finally not complicated :)

The only steps are:

Edit (2021/10) Latest versions of Kafka end up with an AccessDeniedException upon startup, and even when successfully started, throw the same error during log rotation. Kafka utilizes Java methods designed for Unix filesystem libraries, so installing Kafka in WSL2 is recommended (link to Confluent blog, but steps also applicable to Apache Kafka direct installation).

Old answer

  1. Download Kafka and uncompress it somewhere nice (let's say C:/Kafka)
  2. Install Cygwin

If using Cygwin, edit \bin\kafka-run-class.sh and at the end of the file, change

`exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@"`

to

``exec java $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp `cygpath -wp $CLASSPATH` $KAFKA_OPTS "$@"``
  1. In Environment Variables, Add java to your Path System Variable:

enter image description here

That's it.. you can now run ZooKeeper and Kafka servers and start playing with topics and stuff..

like image 176
Yves M. Avatar answered Nov 17 '22 15:11

Yves M.


These are the steps I followed to run kafka on Windows

  1. Install Zookeeper first (I downloaded v3.3.6) zookeeper-3.3.6.tar.gz
  2. Extract Zookeeper and run this command in powershell/cmd \zookeeper-3.3.6\bin> .\zkServer.cmd Now this should up a Zookeeper instance on localhost:2181
  3. Download Kafka binary version (I downloaded v0.10.0.1)kafka_2.10-0.10.0.1.tgz
  4. Extract Kafka, time to modify some configs
  5. Inside Kafka extraction you can find .\config\server.properties
  6. In .\config\server.properties replace log.dirs=c:/kafka/kafka-logs
  7. Note: Make sure to create those folders in relevant paths
  8. Happy news: Now Kafka ships with windows .bat scripts, You can find these files inside ./bin/windows folder
  9. Start powershell/cmd and run this command to start Kafka broker .\bin\windows\kafka-server-start.bat .\config\server.properties
  10. DONE!, Now you have a running Zookeeper instance and a Kafka broker.
like image 22
noelyahan Avatar answered Nov 17 '22 13:11

noelyahan