This is a quick start guide to setup 2 node (broker) cluster on the Mac-OSX.
Steps to install:
1. Download apache kafka from the http://kafka.apache.org/downloads.html
2. extract to some folder in my example i have created in /tmp folder
3. Create kafka logs directory
7. Start second kafka broker
8. create kafka topic
9. list topic
10. now its time to test kafka setup, for that setup producer and consumers
Steps to install:
1. Download apache kafka from the http://kafka.apache.org/downloads.html
2. extract to some folder in my example i have created in /tmp folder
3. Create kafka logs directory
mkdir /tmp/kafka-logs-1 mkdir /tmp/kafka-logs-24. copy config/server.properties to config/server2.properties as I will be running the two broker on the same machine so the following property needs to be updated in server.properties
broker.id=0 port=9092 log.dirs=/tmp/kafka-logs-1edit the server2.properties accordingly
broker.id=1 port=9091 log.dirs=/tmp/kafka-logs-25. now start the zookeeper with
bin/zookeeper-server-start.sh config/zookeeper.properties6. Start kafka broker
bin/kafka-server-start.sh config/server.properties &
7. Start second kafka broker
bin/kafka-server-start.sh config/server2.properties &
8. create kafka topic
bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic general_topic --partitions 2 --replication-factor 2
9. list topic
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic general_topic
10. now its time to test kafka setup, for that setup producer and consumers
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic general_topic bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic general_topic bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic general_topic --from-beginning
No comments:
Post a Comment