Apache Kafka Installation on Windows with Zookeeper — Create Topics & Run CLI Commands

Apache Kafka Installation on Windows: This step-by-step guide will walk you through installing Apache Kafka 3.9.1 using the classic setup (with Zookeeper), creating topics, and running Kafka CLI commands to produce and consume messages.

apache kafka installation on windows with zookeeper

What Will You Learn?

  • How to install Kafka 3.9.1 on Windows
  • Start Zookeeper and Kafka brokers
  • Create topics using the CLI
  • Send and read messages via the Command Prompt
  • Common issues and how to fix them

📝 Note: Kafka 4.x now supports KRaft mode (Zookeeper-less), but in this guide, we will use the classic Zookeeper-based setup, which is still widely used in production and tutorials.

Prerequisites

Make sure you have the following installed:

Tool & SoftwareVersion
Java JDK11+
Command PromptBuilt-in
7-Zip or WinRARLatest

Step 1: Download Apache Kafka 3.9.1

Go to the official Apache Kafka downloads page. Download the Kafka 3.9.1 binary built with Scala 2.13: kafka_2.13-3.9.1.tgz

Download Apache Kafka 3.9.1, Apache Kafka Installation

Once you click on the download link, you can see the download progress like the image below:

download Apache Kafka and install

After a successful download, you can see it in your Windows Downloads folder:

download Apache Kafka and install

Step 2: Extract the kafka_2.13-3.9.1.tgz

Extract the downloaded file kafka_2.13-3.9.1.tgz to any directory on your computer (eg, C:\kafka_2.13-3.9.1). After extraction, your folder should look like the image below:

download Apache Kafka and install

Step 3: Start Zookeeper & Kafka Server

Open a Command Prompt and navigate to the Kafka home directory. For example, in our case, it is C:\kafka_2.13-3.9.1

Step 3.1: Start Zookeeper first

Execute the following command to start the zookeeper server:

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

Step 3.2: Start Kafka Server

Now, open another Command Prompt and navigate to the Kafka home directory, and execute the following command to start the Kafka server:

Command
bin\windows\kafka-server-start.bat config\server.properties
Start Kafka Server

If everything works, you’ll see logs ending with:
INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

Step 4: Create a Kafka Topic

Open another Command Prompt and run the following command to create a Kafka topic:

Command
bin\windows\kafka-topics.bat --create --topic quickstart-events --bootstrap-server localhost:9092

To verify, run the following command:

Command
bin\windows\kafka-topics.bat --describe --topic quickstart-events --bootstrap-server localhost:9092
Create a Kafka Topic

Step 5: Produce Messages to the Topic

Use Kafka’s console producer tool (kafka-console-producer.bat) to send messages:

Run the following command:

Command
bin\windows\kafka-console-producer.bat --topic quickstart-events --bootstrap-server localhost:9092

After running the command, type your messages. For example-

This is my first event
This is my second event

Hit Enter after each message. Use Ctrl + C to stop.

Produce Messages to the Topic

Step 6: Consume Messages from the Topic

In another Command Prompt window, run the following command to consume messages:

Command
bin\windows\kafka-console-consumer.bat --topic quickstart-events --from-beginning --bootstrap-server localhost:9092

You will see all the messages that were produced earlier:

consume Messages from the Topic

Useful Kafka CLI Commands

Here’s a cheat sheet of the most-used CLI commands on Windows:

ActionCommand
Create topickafka-topics.bat –create –topic my-topic –bootstrap-server localhost:9092 –partitions 1 –replication-factor 1
List topicskafka-topics.bat –list –bootstrap-server localhost:9092
Delete topickafka-topics.bat –delete –topic my-topic –bootstrap-server localhost:9092
Produce messageskafka-console-producer.bat –topic my-topic –bootstrap-server localhost:9092
Consume messageskafka-console-consumer.bat –topic my-topic –from-beginning –bootstrap-server localhost:9092

Step 7: Stop Kafka and Zookeeper

Use Ctrl + C in both Kafka and Zookeeper Command Prompt windows to stop the servers. You can also manually kill the Java processes via Task Manager if needed.

Troubleshooting

IssueSolution
Java is not recognizedMake sure producer sent messages to the correct topic, and the consumer used --from-beginning flag
Kafka won’t startCheck if port 9092 is already in use. Stop other services or change the port in server.properties
Consumer shows nothingMake sure the producer sent messages to the correct topic, and the consumer used --from-beginning flag

What’s Next?

You’ve successfully installed Kafka 3.9.1 on Windows and produced and consumed messages using the CLI.

Now that you have Kafka running, move on to:

Writing Your First Kafka Producer and Consumer in Java
Understanding Kafka Topics, Partitions, and Offsets
Kafka Setup with Spring Boot

Conclusion

Running Kafka on Windows is a great way to get hands-on with distributed messaging locally. Whether you’re building microservices or streaming pipelines, mastering the command-line interface (CLI) is the first step toward becoming a Kafka expert.

If you found this tutorial helpful, consider sharing it or dropping a comment below! 👇


🔁 Want to revisit the lessons or explore more?

⬅️ Return to the Apache Kafka Tutorial Home Page

Whether you want to review a specific topic or go through the full tutorial again, everything is structured to help you master Apache Kafka step by step.

Share with friends

Leave a Comment

Your email address will not be published. Required fields are marked *