SETTING UP KAFKA CLUSTER IN SIMPLE STEPS

  1. [DOWNLOAD KAFKA]

Required :

Url => https://kafka.apache.org/downloads
Version => 2.0.0
Java Version => java version “10.0.2” 2018–07–17
 Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
 Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Click On: 
Binary downloads:
Scala 2.11 — kafka_2.11–2.0.0.tgz (asc, sha512)

From terminal type :

=> tar -xzf kafka_2.11–2.0.0.tgz
=> cd kafka_2.11–2.0.0
=> cd bin

[NOTE]

& = means running zookeeper background or you can ignore this if only you want to see logs printing on console
& = means running server in background

2. [START ZOOKEEPER SERVER]

./zookeeper-server-start.sh /Users/ts5167/Documents/kafka_2.11–2.0.0/config/zookeeper.properties &

3. [START KAFKA SERVER]

./kafka-server-start.sh /Users/ts5167/Documents/kafka_2.11–2.0.0/config/server.properties &

4 . [CREATE TOPIC]

./kafka-topics.sh — create — zookeeper localhost:2181 — replication-factor 1 — partitions 1 — topic avertack

5. [LIST ALL TOPICS]

./kafka-topics.sh — list — zookeeper localhost:2181

6. [DELETE A TOPIC]

./kafka-topics.sh — delete — topic avertack — zookeeper localhost:2181

7. [SEND SOME MESSAGES FROM PRODUCER]

./kafka-console-producer.sh — broker-list localhost:9092 — topic avertack

8. [START CONSUMING SOME MESSAGES FROM PRODUCER]

./kafka-console-consumer.sh — bootstrap-server localhost:9092 — topic avertack — from-beginning

9. [DESCRIBE TOPIC]

./kafka-topics.sh — describe — zookeeper localhost:2181 — topic avertack

10. [KILL SERVER]

=> ps aux | grep server.properties