Let's not go into deep questioning what Kafka and Zookeeper is? If you are here you are already learning about it or working on it. Let's move to the head of this article "Install Kafka WITH Zookeeper Easily"

Here I am going to Install Kafka and Zookeeper using Standard User Account and with Admin privillage. (I know in work env you don't have access to Admin Privillage and you have to raise a Ticket with IT)

Download Files:

  1. JAVA — Java 17 is preferred (Link)
  2. KAFKA — I am using Scala 2.12 (Link)
  3. That's IT

Install Files:

  1. JAVA — Install Java Downloaded fron Adoptium.net
None
Select Accept and Next
Select Install just for you
Select Install Just for you and Next
None
You can update Installatio location By clicking on Browse button and then Next
None
Press Install and Once Done Press Finish

2. Set JAVA_HOME

None
Search Environment in Windows Search and choose Edit environment variable for your account
None
Click on New
None
Set "Variable Name" as mentioned above and in "Variable Value" Enter the Java Installation Path you choose or default one and Press OK
None
Open cmd and verify Java is installed or not

2. Extract Kafka to your home directory: C:\Users\user.name\kafka

None
Entet the home directory path and Extract
None
Go to Extracted Folder
None
Right Click and Select Open in Terminal

Now we launch zookeeper and kafka (please run command in the same order)

  1. Launch zookeeper
C:Users\navneet.kumar\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
None
Then, In the terminal click on Drop Icon and Select Command Prompt, a new tab will get added

2. Launch kafka in new Command Prompt tab

None
navigate to kafka directory using cmd and run kafka
cd kafka

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

3. Create a topic

None
In the terminal click on Drop Icon and Select Command Prompt, a new tab will get added
None

C:\Users\navneet.kumar\kafka\bin\windows\kafka-topics.bat --create --topic testing --bootstrap-server localhost:9092 --partitions 1

4. Send a Message

None
In the terminal click on Drop Icon and Select Command Prompt, a new tab will get added

C:\Users\navneet.kumar\kafka\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic testing
None
Type any message like "Hello"

5. Consume the Message

None
In the terminal click on Drop Icon and Select Command Prompt, a new tab will get added
None
Type Mesage will Replicate in real time
None
You can verify by it sending message and receiving it at other side

Wollah! You've successfully installed Kafka and Zookeeper on Windows without needing any admin privileges!

Issues you might face:

wmic dependency — running zookeeper or kafka can give you error like:

'wmic' is not recognized as an internal or external command, operable program or batch file.

Option 1: To solve this you can follow this article : https://kb.tiger-technology.com/wmic_windows_11

Option 2: Update kafka (C:/Users/user.name/kafka/bin/windows/kafka-server-start.bat) file with below:

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

IF [%1] EQU [] (
    echo USAGE: %0 server.properties
    EXIT /B 1
)

SetLocal
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
    set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
)
IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
    rem Directly set the JVM heap options for 64-bit systems
    set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
)
"%~dp0kafka-run-class.bat" kafka.Kafka %*
EndLocal
  • wmic Removed: The wmic command that was used to determine whether the system is 32-bit or 64-bit has been completely removed.
  • Heap Options Hardcoded: The line that dynamically set the heap options based on the system architecture (wmic check) has been replaced with a static heap size for 64-bit systems. Specifically, 1GB of heap is set for both -Xmx and -Xms.

Remember: Always run Kafka and Zookeeper in the correct order (Zookeeper first, then Kafka).

Don't forget to shut down Kafka and Zookeeper after you're done testing to free up system resources.