Simplified Kafka streaming to run from Windows command prompt
After doing little research from my end, I did simplify the Kafka streaming process to work on Windows command prompt easily. The prerequisite for this simple exercise is like we need Apache Kafka software and a Windows 10 machine with full file/folder access permissions to run the Kafka commands through out the exercise. We can extend this work to next level by adding the security using SSL and we need the jks files to Kafka streaming process by using a properties file (eg:client-ssl.properties) while using producer/consumer commands successfully. Of course, these are not covered in this post but usually that is how most of the organizations used to follow this approach while working on Kafka streaming.
Below are the simple steps to follow on this simple exercise:
1) Download the Apache Kafka => https://www.apache.org/dyn/closer.cgi?path=/kafka/2.4.0/kafka_2.12-2.4.0.tgz
2) Extract the Kafka into C:\Kafka and the structure would be like this way
3) Update the server.properties and zookeeper.properties to copy all the logs in C:\Kafka\logs and C:\Kafka\Zookeeperlogs directories to troubleshoot
4) Run the below commands from multiple Windows command prompts
Start Zookeeper in one command prompt instance:
D:>C:\Kafka\bin\windows\zookeeper-server-start.bat C:\Kafka\config\zookeeper.properties
Start Kafka Cluster in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-server-start.bat C:Kafka\config\server.properties
Create Kafka Topic in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic TEST
Check the configuration of a particular topic:
D:>C:\Kafka\bin\windows\kafka-topics.bat --describe --topic TEST --zookeeper localhost:2181
Alter the configuration of a topic:
D:>C:\Kafka\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --alter --topic TEST --partitions 4
Create a Kafka Console Producer in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic TEST
Create a Kafka Console Consumer in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic TEST --from-beginning
References:
1) Google.com
2) apache.org
Below are the simple steps to follow on this simple exercise:
1) Download the Apache Kafka => https://www.apache.org/dyn/closer.cgi?path=/kafka/2.4.0/kafka_2.12-2.4.0.tgz
2) Extract the Kafka into C:\Kafka and the structure would be like this way
3) Update the server.properties and zookeeper.properties to copy all the logs in C:\Kafka\logs and C:\Kafka\Zookeeperlogs directories to troubleshoot
4) Run the below commands from multiple Windows command prompts
Start Zookeeper in one command prompt instance:
D:>C:\Kafka\bin\windows\zookeeper-server-start.bat C:\Kafka\config\zookeeper.properties
Start Kafka Cluster in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-server-start.bat C:Kafka\config\server.properties
Create Kafka Topic in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic TEST
Check the configuration of a particular topic:
D:>C:\Kafka\bin\windows\kafka-topics.bat --describe --topic TEST --zookeeper localhost:2181
Alter the configuration of a topic:
D:>C:\Kafka\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --alter --topic TEST --partitions 4
Create a Kafka Console Producer in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic TEST
Create a Kafka Console Consumer in other command prompt instance:
D:>C:\Kafka\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic TEST --from-beginning
References:
1) Google.com
2) apache.org

