Kafka working example
We have briefly discussed a basic setup of Kafka as part of Flume examples. The basic setup of Kafka as listed there remains the same, hence the installation steps will remain the same, however we will also look additionally at usage examples of Kafka as a message broker.
The most natural programming language for Kafka is currently Scala or Java. Hence, to keep things simple, we will be using Java as our choice of language for examples.
Installation
- Download the Kafka binaries from the following link, using the command:
wget http://redrockdigimark.com/apachemirror/kafka/0.10.1.1/kafka_2.11-0.10.1.1.tgz
- Change the directory to a user directory, where we will want to extract the contents of the Kafka tarball using the following command. Let us refer the extracted
KAFKA
directory as${KAFKA_HOME}
:
tar -xzvf ${DOWNLOAD_DIRECTORY}/kafka_2.11-0.10.1.1.tgz
- Set
KAFKA_HOME
as environment variable using the following commands and add the same into~/.bashrc
:
export KAFKA_HOME=<PATH...