Skip to content

Instantly share code, notes, and snippets.

@Akhi1
Created September 3, 2020 15:26
Show Gist options
  • Save Akhi1/9af39b0bb50771b7fe1eede5a3018b3c to your computer and use it in GitHub Desktop.
Save Akhi1/9af39b0bb50771b7fe1eede5a3018b3c to your computer and use it in GitHub Desktop.
Steps to run Kafka in a Windows PC along with Creating a Topic, Publishing to and Consuming a Topic and Deleting logs
Original Documentation for download and steps:
https://kafka.apache.org/quickstart
Download latest version of kafka server:
https://www.apache.org/dyn/closer.cgi?path=/kafka/
==================================================
Download and extract kafka to any directory (mine is installed in C:\kafka)
Open command prompt from within this folder ('kafka' in my case)
That's it. Execute the following respective commands.
==================================================
#run zookeeper
bin\windows\zookeeper-server-start.bat config\zookeeper.properties
#run kafka server
bin\windows\kafka-server-start.bat config\server.properties
#create topic
bin\windows\kafka-topics.bat --create --topic <topicname> --bootstrap-server localhost:9092
#view topic stats
bin\windows\kafka-topics.bat --describe --topic <topicname> --bootstrap-server localhost:9092
#publish to topic
bin\windows\kafka-console-producer.bat --topic <topicname> --bootstrap-server localhost:9092
#consume from topic
bin\windows\kafka-console-consumer.bat --topic <topicname> --from-beginning --bootstrap-server localhost:9092
#delete topic logs
rm -rf \logs\kafka-logs \logs\zookeeper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment