Kafka

https://kafka.apache.org/

A distributed streaming platform.

  1. can be used as an enterprise messaging system

  2. can be used it as a stream processing platform. Kafka gives a stream, and we can plug in a processing framework.

  3. Also provides connectors to export and import bulk data from databases and other systems.

https://kafka.apache.org/images/kafka_diagram.png

Install/Unzip Apache Kafka

tar -zxvf kafka_2.11-0.10.1.0.tgz

Start Kafka Server

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

kafka-topics.sh is a tool to manage a Kafka

Create Kafka Topic (replication factor 3, and 2 partitions)

bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic TopicName --partitions 2 --replication-factor 2

describe Kafka Topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic TopicName
  • ISR is a list of In Sync Replicas

Start Kafka Producer and Consumer

console producer

console consumer

Broker Configurations

complete list : https://kafka.apache.org/documentation/#brokerconfigs

Build.sbt

Simple Kafka producer

Last updated

Was this helpful?