Setting up a Local Kafka Environment on Windows
===============================================
Note: It’s recommended to place Kafka and ZooKeeper folders in the root directory (C:/Windows) without any spaces in the folder names to avoid potential issues.
Prerequisites
Step 1: Download Kafka and ZooKeeper
Download the following files:
Step 2: Extract Kafka and ZooKeeper
Extract the downloaded Kafka and ZooKeeper files to C:/Windows.
Step 3: Configure ZooKeeper
Navigate to C:/Windows/zookeeper/conf.
Rename zoo_sample.cfg to zoo.cfg.
Edit zoo.cfg and set dataDir=C:/Windows/zookeeper/data.
Step 4: Start ZooKeeper
Open a terminal and navigate to C:/Windows/zookeeper. Run:
binzkServer.cmd
Step 5: Configure Kafka
Navigate to C:/Windows/kafka/config.
Edit server.properties.
Set zookeeper.connect=localhost:2181.
Step 6: Start Kafka Server
Open a terminal and navigate to C:/Windows/kafka. Run:
binwindowskafka-server-start.bat configserver.properties
Step 7: Create a Topic
In a new terminal, navigate to C:/Windows/kafka. Run:
binwindowskafka-topics.bat –create –zookeeper localhost:2181 –replication-factor 1 –partitions 1 –topic test
Step 8: Start Producer
In a new terminal, navigate to C:/Windows/kafka. Run:
binwindowskafka-console-producer.bat –broker-list localhost:9092 –topic test
Step 9: Start Consumer
In a new terminal, navigate to C:/Windows/kafka. Run:
binwindowskafka-console-consumer.bat –bootstrap-server localhost:9092 –topic test –from-beginning
Now you have a local Kafka environment set up on your Windows machine!