Kafka Installation
How to install Kafka quickly in Windows 10? Complete Steps
Installing Kafka on windows
--
Downloading the Required Files
- Download Java 8 or higher https://www.oracle.com/in/java/technologies/javase-jdk11-downloads.html
- Download and extract Kafka using 7-zip from http://kafka.apache.org/downloads.html
Installation
A. Java Setup
1. Start the JRE installation and hit the “Change destination folder” checkbox, then click ‘Install.’
2. Change the installation directory to any path without spaces in the folder name. E.g. C:\Java\jre1.8.0_xx\. (By default it will be C:\Program Files\Java\jre1.8.0_xx), then click ‘Next.’
3. Now open the system environment variables dialogue by opening Control Panel -> System -> Advanced system settings -> Environment Variables.
4. Hit the New User Variable button in the User variables section, then type JAVA_HOME in Variable name and give your jre path in the Variable value. It should look like the below image:
(Java path and version may change according to the version of Kafka you are using)
5. Now click OK.
6. Search for a Path variable in the “System Variable” section in the “Environment Variables” dialogue box you just opened.
7. Edit the path and type “;%JAVA_HOME%\bin” at the end of the text already written there, just like the image below:
8. To confirm the Java installation, just open cmd and type “java –version.” You should be able to see the version of Java you just installed.
If your command prompt somewhat looks like the image above, you are good to go. Otherwise, you need to recheck whether your setup version matches the correct OS architecture (x86, x64), or if the environment variables path is correct.
B. Setting Up Kafka
check GitHub link for simplicity
- Go to your Kafka config directory.
For me, it's C:\kafka\config (I have renamed the existing folder to Kafka for simplicity)
Edit server.properties file
# A comma-separated list of directories under which to store log files
log.dirs=c:/kafka/kafka-logs (close file after saving)
Edit zookeeper.properties file
# the directory where the snapshot is stored.
dataDir=c:/kafka/zookeeper-data (close file after saving)
2. Always start zookeeper first
go to kafka folder, then start the zookeeper server and pass the config file to it.
c:\kafka > .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
→ you can see zookeeper has been started on port #2181
Start Kafka server
new cmd → go to Kafka folder, then start Kafka server and pass config file to it.
c:\kafka > .\bin\windows\kafka-server-start.bat .\config\server.properties
→ you can see Kafka server is running with brokerId=0
Check logs for details
you can check details in a log about the server
go to → C:\kafka\logs