Ubuntu + Apache Kafka Installation

http://vulab.com/blog/?p=576


Aim of this Kafka Tutorial:

Install Apache Kafka, Create a topic and use a producer to send test messages to Kafka Topics. Also launch a consumer to consume messages from Kafka Topics.

Step 1:

Our aim is to install a Ubuntu 64bit server using Oracle Virtual box.

Please download Ubuntu server from this link Download Ubuntu Server

Please download Oracle Virtual Box from this link Download Virtual Box

Follow the instructions online to get your Virtual Box started with Ubuntu 64 bit server. Google is your best bet to get the correct instructions for this step.

Note: Make sure you have JDK installed on the OS.

On my machine java -version is displaying the following version
vulab-build-system:~$ java -version
java version “1.8.0_11″
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Step 2:

Download Apache Kafka version 0.8.1.1 from Download Apache Kafka

You can use wget http://mirror.sdunix.com/apache/kafka/0.8.1.1/kafka_2.9.2-0.8.1.1.tgz

apache_kafka_download

Step 3:

Unzip or expand the zip file downloaded at previous step.

tar -xzf kafka_2.9.2-0.8.1.1.tgz
CD to the folder and explore the folder structure.

Step 4:

Apache Kafka requires zookeeper to be available and running.

Start zookeeper with the following command

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

Step 5:

Start Kafka Server using the following command

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

Step 6:

Create a topic in Apache Kafka using the following command

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1
 --partitions 1 --topic test
Output will be displayed as Created topic "test"

Step 7:

Ask Zookeeper to list available topics on Apache Kafka.

Command is as below:

bin/kafka-topics.sh --list --zookeeper localhost:2181
Output will be displayed as test

Step 8:

Send test messages to Apache Kafka topic called Test using command line producer

Please use the below command

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
Please enter some messages like "Hello vulab" press enter
Enter another message "How are you kafka?" and press enter.

Step 9:

Use command line consumer to check for messages on Apache Kafka Topic called test
Please use the following command

bin/kafka-console-consumer.sh –zookeeper localhost:2181 –topic test –from-beginning
You will see messages printed on the console like “Hello vulab”

With this step you have successfully verified that you have a valid Apache Kafka setup with Apache Zookeeper.

We had Success and what is next?

You did good. In the next step we are going to setup an Apache Maven project in Eclipse IDE. We will use Apache Kafka Producer API and Apache Consumer API to publish and subscribe messages using Apache Kafka. Get ready for the next tutorial in this Apache Kafka learning series by Vulab.

- See more at: http://vulab.com/blog/?p=576#sthash.CijJE2Da.dpuf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值