๐ Assuming Kafka is extracted at:
C:\kafka\kafka_2.13-3.6.1
๐ Change Directory First
cd C:\kafka\kafka_2.13-3.6.1
๐ Step 1: Start ZooKeeper
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
๐ Default ZooKeeper port: 2181
๐ Step 2: Start Kafka Server (Broker)
.\bin\windows\kafka-server-start.bat .\config\server.properties
๐ Default Kafka port: 9092
๐ Stop Kafka and ZooKeeper
Just press Ctrl + C
in the terminal where it's running.
๐ Step 3: Topic Management
โ Create Topic
.\bin\windows\kafka-topics.bat --create --topic my-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
๐ List All Topics
.\bin\windows\kafka-topics.bat --list --bootstrap-server localhost:9092
๐ Describe Topic (details)
.\bin\windows\kafka-topics.bat --describe --topic my-topic --bootstrap-server localhost:9092
โ Delete Topic
.\bin\windows\kafka-topics.bat --delete --topic my-topic --bootstrap-server localhost:9092
โ๏ธ Step 4: Messaging (Produce/Consume)
โ Start Producer (Send messages)
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic my-topic
Start typing messages and press
Enter
to send.
๐ฅ Start Consumer (Read messages)
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic my-topic --from-beginning
๐ Step 5: Consumer Groups
๐ List Consumer Groups
.\bin\windows\kafka-consumer-groups.bat --bootstrap-server localhost:9092 --list
๐ Describe a Consumer Group
.\bin\windows\kafka-consumer-groups.bat --bootstrap-server localhost:9092 --describe --group my-group
โ๏ธ Step 6: Configuration & Monitoring
๐ Broker Configuration
Edit:
config\server.properties
To change broker ID, port, log dir, etc.
๐ ZooKeeper Configuration
Edit:
config\zookeeper.properties
๐งน Clean Kafka Data (Log Reset - optional)
To clear all Kafka data (topics, messages):
rmdir /s /q .\kafka-logs
rmdir /s /q .\zookeeper-data
Be cautious โ this deletes all Kafka state.
๐ฆ Additional Utilities
๐ Kafka Producer Performance Test
.\bin\windows\kafka-producer-perf-test.bat --topic my-topic --num-records 1000 --record-size 100 --throughput -1 --producer-props bootstrap.servers=localhost:9092
๐งช Kafka Consumer Performance Test
.\bin\windows\kafka-consumer-perf-test.bat --bootstrap-server localhost:9092 --topic my-topic --messages 1000 --group test-group
๐ Full Flow Summary (One-Line Index)
1. Start ZooKeeper
2. Start Kafka Server
3. Create Topic
4. List Topics
5. Describe Topic
6. Delete Topic
7. Send Messages (Producer)
8. Read Messages (Consumer)
9. List Consumer Groups
10. Describe Group
11. Delete Logs (Optional)
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.