This tutorial will help you install and start Kafka 0.10.2.0 on the EC2 Linux instance, including starting a Zookeeper service, on the centOS operating system.
In this blog, we will install and start a single-node, latest and recommended version of Kafka 0.10.2.0 with the binary for Scala 2.12 on the EC2 Linux instance with centOS as its operating system. We will be using the t2.micro (free tier) instance which comes with 1 GB RAM and 8 GB SSD.
Steps for creating an AWS instance are clearly mentioned in the official AWS documentation; check here .
Since we will be working with the Kafka binary for Scala 2.12, our instance must have Java 8. By default, the EC2 instances have Java 7. You may check and upgrade the Java version to 8 on your instance by following the steps here.
After installing Java 8, follow the steps mentioned below in sequence to start Kafka on your instance.
Download kafka_2.12-0.10.2.0.tgz
Extract the .tgz file
Since the zip is of no use now, we remove it:
Insert the following environment variable.
After setting the variable, source your .baschrc.
After successfully staring Zookeeper, it’s now time to start Kafka via the following command:
This successfully starts Kafka on your EC2 instance. You may access your Kafka-server via Kafka-Scala or Kafka-Java API by making the required changes in the security groups. To stop Kafka and Zookeeper, enter the following commands:
Hope this blog helps you. Comments and suggestions are welcomed.