← Back to Blog

Kafka 4.0 Windows Setup in 2025: KRaft Mode WITHOUT ZooKeeper!

#Kafka#Apache Kafka 4.0#KRaft#Windows#ZooKeeper-free#Developers#Streaming
Share
AdSponsored Content

Setting up Kafka on Windows has traditionally been… painful.

Juggling ZooKeeper, random configuration errors, path issues, and multiple services often turned a simple dev setup into an evening of debugging.

Apache Kafka 4.0 changes that story.

With KRaft mode, Kafka no longer depends on ZooKeeper. That means:

  • No extra ZooKeeper service
  • Fewer moving parts
  • A much cleaner Windows experience

This guide walks you through every step of getting Kafka running in KRaft mode, including fixes for the most common Windows errors.


First, download Kafka from the official downloads page:
https://kafka.apache.org/downloads

Look for Kafka 4.0 or later — such as 4.1.0.

You’ll find entries like:

  • kafka_2.13-4.1.0.tgz

Extract using:

  • 7-Zip
  • WinRAR
  • Windows 11 built-in extractor

Extract to:

  • C:\Common\kafka
  • C:\kafka

Avoid spaces in the path.

Pull the official Kafka Docker image:

bash
docker pull apache/kafka:latest

Run it:

bash
docker run -p 9092:9092 apache/kafka:latest

  • Java 11 or newer
    Check version: java -version
  • Kafka 4.x extracted
  • Basic command line knowledge
  • 7-Zip or equivalent

Older Kafka versions required ZooKeeper, meaning more processes, more config, more errors.

KRaft mode removes ZooKeeper entirely:

  • Kafka manages its own metadata
  • Fewer moving parts
  • Cleaner setup on Windows

Point it to your Kafka folder:

C:\Common\kafka

Add:

%KAFKA_HOME%\bin\windows

Run:

bash
kafka-storage.bat --version

bash
kafka-storage.bat random-uuid

Basic setup:

bash
kafka-storage.bat format -t YOUR_CLUSTER_ID -c config/server.properties
bash
kafka-server-start.bat config/server.properties

Create topic:

bash
kafka-topics.bat --create --topic test-topic --bootstrap-server localhost:9092

Producer:

bash
kafka-console-producer.bat --topic test-topic --bootstrap-server localhost:9092

Consumer:

bash
kafka-console-consumer.bat --topic test-topic --from-beginning --bootstrap-server localhost:9092

Make sure you're in Kafka’s root folder when running commands.

Delete the logs directory:

bash
rmdir /s /q C:\Common\kafka\tmp\kraft-combined-logs

Then format again.

Delete:

bash
rmdir /s /q C:\tmp\kraft-combined-logs

Re-format.

Windows 11 often removes WMIC.

Quick fix: set static heap size by editing kafka-server-start.bat:

bat
set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M

List topics:

bash
kafka-topics.bat --list --bootstrap-server localhost:9092

Describe topic:

bash
kafka-topics.bat --describe --topic test-topic --bootstrap-server localhost:9092

Delete topic:

bash
kafka-topics.bat --delete --topic test-topic --bootstrap-server localhost:9092

You now have a full Kafka 4.x KRaft single-node setup. Next steps:

  • Add security
  • Tune performance
  • Add replication
  • Monitor Kafka

Kafka on Windows used to be frustrating — but KRaft mode simplifies everything. Most issues now are Windows-specific (like WMIC), not Kafka-related.

If you hit an issue, the Kafka documentation and community are incredibly helpful.

Happy streaming!

AdYou might also like