How to configure kafka

--Resource --

1. Download

1. Click here to download
2. from Binary downloads , download the latest version (eg: Scala 2.13 - kafka_2.13-3.2.1.tgz (asc, sha512))

2. Extract and Move

1. Extract this downloaded file.
2. Move that folder to the installation directories (your choice!)

3. Add path to Environemnt path variables

1. Go to the kafka root folder
2. Go to bin/windows folder and copy the directory path
3. Go to This PC -> right click and Click on Properties
4. Go to Advanced system settings -> Environemnt Variables
5. Under System varibles Choose 'path' and click on edit
6. Click on New -> add the path here
7. Click ok and close all window

4. Configure

1. Go to the kafka root folder
2. Create a folder named “data”
3. Goto to the folder “data”
4. Create 2 folders. One with the name “zookeeper”, another with the name “kafka”
5. Copy the entire path to the “zookeeper” folder
6. Go to the configuration folder inside the kafka root folder
7. Open the zookeeper.properties file and paste the path to the zookeeper folder to the “dataDir” property
8. Change all “\” to “/” (forward slash to backward slash)
9. Go to the “config” folder again and edit “server.properties”
10. Change the “log.dirs” property to point to the kafka folder inside the data folder which you have created in step 4
11. Change all “\” to “/” (forward slash to backward slash)

5. Run

1. Go to the kafka root folder and open a terminal here
2. To start the zookeeper: give this command
zookeeper-server-start config/zookeeper.properties
3. Open another terminal on the same directory
4. To start the Kafka Server : give this command
kafka-server-start config\server.properties

6. Create Topic

1. To create a topic : give this command
kafka-topics --create --topic test-topic --bootstrap-server localhost:9092 --replication-factor 1 --partitions 4
2. To get list of topics : give this command
kafka-topics.bat --list --bootstrap-server localhost:9092

7. Publish and Subscribe

1. To send message as producer: give this command
kafka-console-producer --broker-list localhost:9092 --topic test-topic
2. To access message as consumer : give this command
kafka-console-consumer --bootstrap-server localhost:9092 --topic test-topic --from-beginning