Created
April 10, 2015 20:35
-
-
Save sathish-io/3b1ea2ad7de4d3004548 to your computer and use it in GitHub Desktop.
Kafka setup commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Home: /Users/skandasa/installs/kafka_2.10-0.8.2.0 | |
1) start a ZooKeeper server | |
bin/zookeeper-server-start.sh config/zookeeper.properties | |
binding to port 0.0.0.0/0.0.0.0:2181 | |
2) Start brokers | |
a) bin/kafka-server-start.sh config/server.properties | |
- starts with port 9092 | |
b) bin/kafka-server-start.sh config/server-1.properties | |
- starts with port 9093 | |
c) bin/kafka-server-start.sh config/server-2.properties | |
- starts with port 9094 | |
3) create a new topic with a replication factor of three | |
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic app-events-topic | |
4) To know which broker is doing what on the new topic | |
bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic app-events-topic | |
results: | |
Topic:app-events-topic PartitionCount:1 ReplicationFactor:3 Configs: | |
Topic: app-events-topic Partition: 0 Leader: 1 Replicas: 1,2,0 Isr: 1,2,0 | |
5) publish a few messages to app-events-topic topic | |
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic app-events-topic | |
5) consume messages from topic: app-events-topic | |
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic app-events-topic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment