To install Kafka on Windows 10, you can follow these steps:
1.Download Apache Kafka:
Go to the official Apache Kafka website: https://kafka.apache.org/downloads
Scroll down to the “Binary downloads” section and click on the link to download the latest stable release of Kafka.
2.Extract the Kafka archive:
Once the download is complete, extract the contents of the downloaded archive to a directory of your choice (e.g., C:\kafka).
1.Configure Kafka:
Open the config directory inside the extracted Kafka folder (C:\kafka\config).
Rename the server.properties file to server.properties.example.
Create a new file called server.properties in the same directory (C:\kafka\config).
Open the server.properties file and configure Kafka according to your requirements. You may need to modify settings such as advertised.listeners or log.dirs.
2.Start ZooKeeper:
Kafka depends on ZooKeeper, so you need to start it first.
Open a command prompt and navigate to the Kafka directory (C:\kafka).
Run the following command to start ZooKeeper:
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
3.Start Kafka:
Open another command prompt and navigate to the Kafka directory (C:\kafka).
Run the following command to start Kafka:
.\bin\windows\kafka-server-start.bat .\config\server.properties
Kafka should now start running on your local machine.
4.Test Kafka:
To test if Kafka is running correctly, you can create a topic and produce/consume messages.
Open a new command prompt and navigate to the Kafka directory (C:\kafka).
Create a topic with the following command:
.\bin\windows\kafka-topics.bat --create --topic test-topic --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1
Start a producer to send some messages to the topic:
.\bin\windows\kafka-console-producer.bat --topic test-topic --bootstrap-server localhost:9092
Start a consumer to receive the messages:
.\bin\windows\kafka-console-consumer.bat --topic test-topic --bootstrap-server localhost:9092 --from-beginning
Now you can type messages in the producer console, and they should appear in the consumer console.
That’s it! You have successfully installed and configured Kafka on Windows 10.
Happy Learning