How to install Kafka on Windows?

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..

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)