01: Getting started with Apache Kafka on Mac tutorial

Prerequisite This tutorial assumes that Java 8 is installed. You check this with

If Java is not installed, you can install it on Mac with:

Note: If you are using windows, use *.bat files instead of “*.ksh” in steps shown below. Replace “/” with “\” on the DOS terminal.

Step 1: Install Kafka in “/usr/local“. [on windows: c:/tools ]

Kafka & internal zookeeper will be installed in the folder “/usr/local/kafka_2.11-2.1.0

Step 2: Start zookeeper from “/usr/local/kafka_2.11-2.1.0”.

The zookeeper will be running on “localhost:2181

Step 3: Open a new terminal window and start kafka.

The Kafka server will be running on “localhost:9092“. You can verify this with

Step 4: Open a new terminal window and create a new topic named “test”.

Step 5: Open a new terminal window and create a producer.

You will get a prompt “>” where you can type messages to be sent to the Kafka topic.

Step 6: Open a new terminal window and create a consumer.

Send & Receive messages

Now if you send any text message from the terminal where producer was started, you will see that message in the consumer terminal.

For example:

Producer:

Consumer:


800+ Java & Big Data Interview Q&As

Top