FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 531   



1. Install Java

sudo apt-get update
sudo apt-get install default-jre
sudo apt-get install default-jdk

2. Download Kafka

wget http://www-us.apache.org/dist/kafka/1.0.0/kafka_2.11-1.0.0.tgz
tar -xzf kafka_2.11-1.0.0.tgz
cd kafka_2.11-1.0.0

3. Update configs

in producer.properties & consumer.properties change
bootstrap.servers=localhost:9092
to
bootstrap.servers=<server_ip>:9092

in in server.properties
#advertised.listeners=PLAINTEXT://your.host.name:9092
to
advertised.listeners=PLAINTEXT://<server_ip>:9092

4. Start Zookeeper

bin/zookeeper-server-start.sh config/zookeeper.properties &

5. Start Kafka

bin/kafka-server-start.sh config/server.properties &

6. Create hello-world topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic hello-world

7. List available topics

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

8. Publish sample messages using console-producer

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic hello-world

9. Consume messages using console-consumer

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic hello-world --from-beginning



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News