Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ifejeremiah/7d44e9f8dbd2bff5b788f07c4dd3c22d to your computer and use it in GitHub Desktop.
Save Ifejeremiah/7d44e9f8dbd2bff5b788f07c4dd3c22d to your computer and use it in GitHub Desktop.
CMD Commands for running Kafka on Windows

Running Kafka on Windows using CMD Commands.

Download Kafka, a open-source software platform developed by LinkedIn to handle real-time data.

Getting Started:

  • Run Command Line as Administrator.

  • Run command to start up zookeeper server.

    • > cd ../../kafka
      > bin\windows\zookeeper-server-start.bat config\zookeeper.properties  
      
  • Run command to start up kafka server.

    • > cd ../../kafka
      > bin\windows\kafka-server-start.bat config\server.properties 
      
  • Run command to create a topic to Store your Events.

    • > cd ../../kafka
      > bin\windows\kafka-topics.bat --create --partitions 1 --replication-factor 1 --topic [YOUR KAFKA TOPIC] --bootstrap-server localhost:9092  
      
  • Run command to write some events into the Topic.

    • > cd ../../kafka
      > bin\windows\kafka-console-producer.bat --topic [YOUR KAFKA TOPIC] --bootstrap-server localhost:9092 
      
  • Run command to read the events.

    • > cd ../../kafka
      > bin\windows\kafka-console-consumer.bat --topic [YOUR KAFKA TOPIC] --from-beginning --bootstrap-server localhost:9092 
      
  • Delete any data of your local Kafka environment including any events.

    • Close all kafka processes on other terminal sessions. Ctrl-C.

    • > cd ../../kafka
      > tree /f 
      > rmdir /s kafka-logs && rmdir /s zookeeper-data   
      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment