Join us on the demo, while our product experts provide a detailed walkthrough of our enterprise platform.

logoAsync

The latest news in the world of engineering.

Identity and Access Management (IAM), including security and customer experience.

Visit Blog
Fuel

Grow your business to millions.Engage and retain your customers.

Visit Blog

Setting Up and Running Apache Kafka on Windows OS

In this post, we will look at the step-by-step process for Kafka Installation on Windows. Kafka is an open-source stream-processing software platform and comes…

Ashish Sharma
Ashish Sharma
August 25, 2020
2 min read

Free, Secure and Trusted Way to Authenticate Your Visitors

Add login to your website in 5 minutes completely for free!

Free Sign UpNo hidden costs. No credit card needed.

In this post, we will look at the step-by-step process for Kafka Installation on Windows. Kafka is an open-source stream-processing software platform and comes under the Apache software foundation.

What is Kafka?

Kafka is used for real-time streams of data, to collect big data, or to do real-time analysis (or both). Kafka is used with in-memory microservices to provide durability and it can be used to feed events to complex event streaming systems and IoT/IFTTT-style automation systems.

Installation :

1. Java Setup:

Kafka requires Java 8 for running. And hence, this is the first step that we should do to install Kafka. To install Java, there are a couple of options. We can go for the Oracle JDK version 8 from the Official Oracle Website.

2. Kafka & Zookeeper Configuration:

Step 1: Download Apache Kafka from its Official Site.

Step 2: Extract tgz via cmd or from the available tool to a location of your choice:

tar -xvzf kafka_2.12-2.4.1.tgz

Step 3: Copy the path of the Kafka folder. Now go to config inside Kafka folder and open zookeeper.properties file. Copy the path against the field dataDir and add /zookeeper-data to the path.

zookeeper Step 4: we have to modify the config/server.properties file. Below is the change:

fileslog.dirs=C:\kafka\kafka-logs

Basically, we are pointing the log.dirs to the new folder /data/kafka.

Run Kafka Server:

Step 1: Kafka requires Zookeeper to run. Basically, Kafka uses Zookeeper to manage the entire cluster and various brokers. Therefore, a running instance of Zookeeper is a prerequisite to Kafka.

To start Zookeeper, we can open a PowerShell prompt and execute the below command:

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

If the command is successful, Zookeeper will start on port 2181.

Step 2: Now open another command prompt and change the directory to the kafka folder. Run kafka server using the command:

.\bin\windows\kafka-server-start.bat .\config\server.properties

Now your Kafka Server is up and running, you can create topics to store messages. Also, we can produce or consume data directly from the command prompt.

Create a Kafka Topic:

  1. Open a new command prompt in the location C:\kafka\bin\windows.
  2. Run the following command:
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

Creating Kafka Producer:

  1. Open a new command prompt in the location C:\kafka\bin\windows
  2. Run the following command:
kafka-console-producer.bat --broker-list localhost:9092 --topic test

Creating Kafka Consumer:

  1. Open a new command prompt in the location C:\kafka\bin\windows.
  2. Run the following command:
kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning

If you see these messages on consumer console,Congratulations!!! you all done. Then you can play with producer and consumer terminal bypassing some Kafka messages.



LoginRadius Docs

Implement Authentication in Minutes

click here

Most Popular Tags

EngineeringJavaScriptReactNodeJsAuthenticationCSSSecurityC#OAuthGo

Do you want a free authentication solution?

Add the world's most secure, reliable and easy to implement user authentication solution on your applications at $0Get Started Free

Ashish Sharma

Ashish Sharma

Ashish is a software engineer who continually seeks clean, elegant solutions to business challenges. His lifelong passion for technology drives him to proactively expand horizons, constantly exploring and evaluating new languages, platforms, frameworks and tools.

View Profile

Try a Modern Authentication Solution

$0/ month

Free Sign Up
  • 7,000 Monthly Active Users
  • 1 Web or Mobile App
  • Email/Password Login
  • 3 Social Login Providers
  • User Data Storage
  • Transactional Email Template
  • Customizable Login Interfaces