Categories
Bigdata

Configuring Apache Kafka Environment

Kafka is used widely in social networking websites because of its performance. Refer Kafka introduction for more information.  Here i’m going to show how to setup Kafka in simple 8 steps.

Step 1

Download Kafka from Apache Website:
https://www.apache.org/dyn/closer.cgi?path=/kafka/0.8.2.2/kafka_2.9.1-0.8.2.2.tgz

Step 2

Untar downloaded archive.

Step 3

cd kafka_2.9.2-0.8.2.2

Step 4

Start zookeeper which is used for Synchronizing producers and consumers.
bin/zookeeper-server-start.sh config/zookeeper.properties

Step 5

start Kafka Server
bin/kafka-server-start.sh config/server.properties

Step 6

Create topics for Kafka producer and consumer
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic kafkatopic2

Step 7

Start kafka Producer and type some messages
bin/kafka-console-producer.sh --broker-list localhost:9092 --sync --topic kafkatopic2

Step 8

Start Kafka Consumer and observe that the messages you typed in #Step 7 , getting consumed.
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic kafkatopic2 --from-beginning

So you have successfully setup the kafka . We will try to add more consumers and producers in next post.

 

2 replies on “Configuring Apache Kafka Environment”

Leave a Reply

Your email address will not be published. Required fields are marked *