Apache Kafka is an open source distributed event streaming plateform used by thousands of companies for hight performance data pipeline, streaming analytics, data integration and mission critical applications.
Downloading Apache Kafka and install
Apache kafka can be downloaded from official website https://kafka.apache.org/downloads
Download apache kafka from above link and follow the given process
Step 1: Extract the downloaded kafka folder and go to kafka folder.
Step 2: Go to Zookeeper.properties file (kafka>>config>>zookeeper.properties), open this file and copy the path agaist the field dataDir and /zookeeper-data to the path.
Step 3: Go to server.properties file (kafka>>config>>server.properties), open this file and scroll down to log.dirs and paste the path to. To the path add /kafka-logs.
Step 4: Open this folder in cmd and start the zooper keeper through given commond.
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
After that start the zookeeper-server.
Step 5: Open this folder in cmd and start the kafka server through given commond.
.\bin\windows\kafka-server-start.bat .\config\server.properties
Let check Apache kafka is working or not?
Step 6: Run given command for storing data in kafka topic. Go to kafka folder and open in cmd.
.\bin\windows\kafka-console-producer.bat --topic topic-example --bootstrap-server localhost:9092
** In above command Topic Name:- topic-example
- In above command, once you will run the kafka-console-producer command, after that write some event which you want to stroe in apache kafka topic.
- After that press ctrl + c for exist.
How to check event is store in apache kafka topic or not?
Step 7: Run given command for consume the data from apache kafka.
.\bin\windows\kafka-console-consumer.bat --topic topic-example --from-beginning --bootstrap-server localhost:9092
- Above screenshot, you can check which event you have stored through kafka-producer command. All event display here.
That’s all.