Apache Spark Kafka Usecase

  • date 1st March, 2019 |
  • by Prwatech |

Apache Kafka Use Case Tutorial

Apache Kafka Use Case Tutorial, Welcome to the world of advanced Tutorials on the use case for apache spark. Are you looking forward to the Use case example of the Kafka Platform? Or looking for some help on the use case for Kafka streams? Then you’ve landed on the Right Path which providing advanced tutorial Based concepts on the Apache Kafka Use Case Examples. In this tutorial, one can easily explore apache Apache Spark real-world Use Cases with step by step explanation.

If you are the one who wanted to become an expert in Apache spark? Or the one who wanted to explore the technology like a Pro under the certified experts with world-class classroom training environment, then asks your Apache spark training institute experts who offer Advanced advanced Apache spark training. Follow the below-mentioned Apache spark use case tutorial and enhance your skills to become a professional Spark Developer.

Apache Kafka Use Case Examples

Case 1.  One producer and one consumer

Create one topic test

bin/Kafka-topics.sh –create –zookeeper localhost:2181 –replication-factor 1 –partitions 1 –topic Hello-Kafka

Apache Kafka Use Case Example

Run the broker

bin/Kafka-console-producer.sh –broker-list localhost:9092 –topic Hello-Kafka

Write your message 

Run the broker

Run the consumer

bin/Kafka-console-consumer.sh –bootstrap-server localhost:9092 –topic test –from-beginning

You will get the message from producer

You will get the message from producer

Case 2. Two producers and One consumer

Create another topic Multibrokerapplication

bin/Kafka-topics.sh –create –zookeeper localhost:2181 –replication-factor 2 –partitions 1 –topic Multibrokerapplication

topic Multibrokerapplication

bin/Kafka-console-producer.sh –broker-list localhost:9092 –topic Multibrokerapplication

topic Multibrokerapplication 2

bin/Kafka-console-consumer.sh –bootstrap-server localhost:9092 –topic institute –from-beginning

topic institute --from-beginning

Case 3: Setting up a multi-broker cluster

let’s expand our cluster to 2 nodes (still all on our local machine)

cp config/server.properties config/server.properties

cp config/server.properties config/server-one.properties

Apache Kafka Use Case Example 3

Now edit these new files and set the following properties:



We already have Zookeeper and our single node started, so we just need to start the two new nodes

bin/Kafka-server-start.sh config/server-one.properties

config/server-one.properties 2

Now create a new topic with a replication factor of three:

bin/Kafka-topics.sh –create –zookeeper localhost:2181 –replication-factor 2 –partitions 1 –topic Multibrokerapplication

config/server-one.properties 3

bin/Kafka-topics.sh –describe –zookeeper localhost:2181 –topic Multibrokerapplication

replication factor 2

bin/kafka-console-producer.sh –broker-list localhost:9092 –topic Multibrokerapplication

broker-list localhost:9092

bin/kafka-console-consumer.sh –bootstrap-server localhost:9092 –from-beginning –topic Multibrokerapplication

 bootstrap-server localhost:9092

Case 4:-  Deleting topic form list

Deleting topic form list

Deleting topic form list 2

Deleting topic form list 3

We hope you understand Apache spark Use Case tutorial with examples concepts. Get success in your career as a Spark Developer by being a part of the Prwatech, India’s leading Apache Spark training institute in Bangalore.

Quick Support

image image