SlideShare uma empresa Scribd logo
1 de 27
Spark-Kafka message
streaming
-vritika godara
❖ Scope
❖ Zookeeper server start
❖ Kafka server start
❖ Create kafka topic and send message
❖ Consume kafka message
❖ List kafka topics
❖ Kafka producer in java
❖ Kafka consumer in java
❖ Spark CLI
❖ Spark word count java app
❖ Kafka-Spark integration
❖ Dataframes
❖ Create table schema in spark
❖ SQL queries
❖ Front-end design
Contents
Scope
❖ Create an application to capture user’s location and send
it to database for real-time data analysis
❖ Demonstrate the use of kafka-spark data streaming for
creation of meaningful analytical reports
Zookeeper server start
Zookeeper server start for kafka
Kafka Server Start
Create Kafka Topic and Send Message
Consume Kafka Message
List Kafka Topics
Kafka Producer
❖ Message is
sent from
kafka in java
app and
consumed
through
command
line
Kafka Consumer
❖ Message produced and
consumed by kafka
using java app
Spark CLI
❖ Following slides contain code
snippets of messages produced
through kafka and consumed
through spark-kafka streaming
User Class
Kafka Producer
❖ Create KafkaProducer object and initialise it by setting its
required properties.
Kafka Producer
❖ Create user object, specify the topic and send the
message using KafkaProducer object
Kafka-Spark Integration
❖ Create JavaStreamingContext with interval of 5 seconds
❖ Set kafka topic from which messages are to be
consumed
❖ Create kafka connector for spark
PostgreSQL Driver
❖ Register PostgreSQL driver for database integration
Dataframe Read
❖ Create dataframe and show tbl_location data
❖ Register tbl_location as data frame table
Spark Table Schema
❖ Create table schema to create a new table in postgresql
using spark
Consume kafka data
❖ Consume the data sent from kafka to create data frame
and register it as table
SQL Queries
❖ Using sqlContext, query the dataframes
❖ Create table “user-location” in postgresql and save
meaningful consumed data for further processing
SQL Queries
❖ Using sqlContext, query the dataframes
❖ Create table “user-institute” in postgresql and save
meaningful consumed data for further processing
SQL Queries
❖ Using sqlContext, query the dataframes
❖ Get list of users logged in from India along with state
and city
❖ Create table “user-country” in postgresql and save
meaningful consumed data for further processing
PostgreSQL Table
❖ Table created by
spark in postgresql
Front End
THANK YOU

Mais conteúdo relacionado

Mais procurados

Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...
Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...
Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...Databricks
 
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)Helena Edelson
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache SparkSamy Dindane
 
Productionizing Spark and the REST Job Server- Evan Chan
Productionizing Spark and the REST Job Server- Evan ChanProductionizing Spark and the REST Job Server- Evan Chan
Productionizing Spark and the REST Job Server- Evan ChanSpark Summit
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceSachin Aggarwal
 
Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015Evan Chan
 
Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...
Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...
Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...Spark Summit
 
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)Robert "Chip" Senkbeil
 
Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)
Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)
Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)Spark Summit
 
How to build your query engine in spark
How to build your query engine in sparkHow to build your query engine in spark
How to build your query engine in sparkPeng Cheng
 
Introduction to apache spark
Introduction to apache spark Introduction to apache spark
Introduction to apache spark Aakashdata
 
Alpine academy apache spark series #1 introduction to cluster computing wit...
Alpine academy apache spark series #1   introduction to cluster computing wit...Alpine academy apache spark series #1   introduction to cluster computing wit...
Alpine academy apache spark series #1 introduction to cluster computing wit...Holden Karau
 
Apache Spark at Viadeo
Apache Spark at ViadeoApache Spark at Viadeo
Apache Spark at ViadeoCepoi Eugen
 
Strata NYC 2015: What's new in Spark Streaming
Strata NYC 2015: What's new in Spark StreamingStrata NYC 2015: What's new in Spark Streaming
Strata NYC 2015: What's new in Spark StreamingDatabricks
 
Jaws - Data Warehouse with Spark SQL by Ema Orhian
Jaws - Data Warehouse with Spark SQL by Ema OrhianJaws - Data Warehouse with Spark SQL by Ema Orhian
Jaws - Data Warehouse with Spark SQL by Ema OrhianSpark Summit
 
The Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago MolaThe Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago MolaSpark Summit
 

Mais procurados (20)

Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...
Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...
Spark DataFrames: Simple and Fast Analytics on Structured Data at Spark Summi...
 
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache Spark
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache Spark
 
Productionizing Spark and the REST Job Server- Evan Chan
Productionizing Spark and the REST Job Server- Evan ChanProductionizing Spark and the REST Job Server- Evan Chan
Productionizing Spark and the REST Job Server- Evan Chan
 
Intro to Apache Spark
Intro to Apache SparkIntro to Apache Spark
Intro to Apache Spark
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault Tolerance
 
Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015
 
Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...
Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...
Spark as a Platform to Support Multi-Tenancy and Many Kinds of Data Applicati...
 
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
Spark Kernel Talk - Apache Spark Meetup San Francisco (July 2015)
 
Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)
Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)
Sqoop on Spark for Data Ingestion-(Veena Basavaraj and Vinoth Chandar, Uber)
 
How to build your query engine in spark
How to build your query engine in sparkHow to build your query engine in spark
How to build your query engine in spark
 
Introduction to apache spark
Introduction to apache spark Introduction to apache spark
Introduction to apache spark
 
Alpine academy apache spark series #1 introduction to cluster computing wit...
Alpine academy apache spark series #1   introduction to cluster computing wit...Alpine academy apache spark series #1   introduction to cluster computing wit...
Alpine academy apache spark series #1 introduction to cluster computing wit...
 
Apache Spark at Viadeo
Apache Spark at ViadeoApache Spark at Viadeo
Apache Spark at Viadeo
 
Spark on YARN
Spark on YARNSpark on YARN
Spark on YARN
 
Data Science
Data ScienceData Science
Data Science
 
Strata NYC 2015: What's new in Spark Streaming
Strata NYC 2015: What's new in Spark StreamingStrata NYC 2015: What's new in Spark Streaming
Strata NYC 2015: What's new in Spark Streaming
 
Jaws - Data Warehouse with Spark SQL by Ema Orhian
Jaws - Data Warehouse with Spark SQL by Ema OrhianJaws - Data Warehouse with Spark SQL by Ema Orhian
Jaws - Data Warehouse with Spark SQL by Ema Orhian
 
The Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago MolaThe Pushdown of Everything by Stephan Kessler and Santiago Mola
The Pushdown of Everything by Stephan Kessler and Santiago Mola
 

Destaque

How to make someone look younger – photoshop tutorial
How to make someone look younger – photoshop tutorialHow to make someone look younger – photoshop tutorial
How to make someone look younger – photoshop tutorialNebiyou Enbakom
 
Chromosomes, chromatin and cellular cycle
Chromosomes, chromatin and cellular cycle Chromosomes, chromatin and cellular cycle
Chromosomes, chromatin and cellular cycle Kamila Varon
 
Bản proposal cho sự kiện ra mắt sản phẩm LG LED
Bản proposal cho sự kiện ra mắt sản phẩm LG LEDBản proposal cho sự kiện ra mắt sản phẩm LG LED
Bản proposal cho sự kiện ra mắt sản phẩm LG LEDPhanYen90
 
презентация семинар доу
презентация семинар доупрезентация семинар доу
презентация семинар доуLary Maty
 
S.A.F.E.T Y at Equine Events
S.A.F.E.T Y at Equine EventsS.A.F.E.T Y at Equine Events
S.A.F.E.T Y at Equine EventsCaroline Payne
 
Daphne_Goris_OT_Resume_2016
Daphne_Goris_OT_Resume_2016Daphne_Goris_OT_Resume_2016
Daphne_Goris_OT_Resume_2016Daphne Goris
 
Các phương pháp thai giáo
Các phương pháp thai giáoCác phương pháp thai giáo
Các phương pháp thai giáoPhanYen90
 
Droplet size and velocity characteristics of agricultural sprays
Droplet size and velocity characteristics of agricultural sprays Droplet size and velocity characteristics of agricultural sprays
Droplet size and velocity characteristics of agricultural sprays Gajanan Bele
 
Evaluation, refinement and development of tractor operated sugarcane cutter p...
Evaluation, refinement and development of tractor operated sugarcane cutter p...Evaluation, refinement and development of tractor operated sugarcane cutter p...
Evaluation, refinement and development of tractor operated sugarcane cutter p...Gajanan Bele
 
Populismo en américa latina
Populismo en américa latinaPopulismo en américa latina
Populismo en américa latinaRaquel Ferrón
 
Design and development of ridge profile power weeder
Design and development of ridge profile power weederDesign and development of ridge profile power weeder
Design and development of ridge profile power weederGajanan Bele
 
Roberto garciajuradosobreelconceptodepopulismo
Roberto garciajuradosobreelconceptodepopulismoRoberto garciajuradosobreelconceptodepopulismo
Roberto garciajuradosobreelconceptodepopulismoRaquel Ferrón
 
Performance evaluation of weeders in cotton
 Performance evaluation of weeders in cotton Performance evaluation of weeders in cotton
Performance evaluation of weeders in cottonGajanan Bele
 

Destaque (20)

How to make someone look younger – photoshop tutorial
How to make someone look younger – photoshop tutorialHow to make someone look younger – photoshop tutorial
How to make someone look younger – photoshop tutorial
 
2 admitidos 2017 (1)
2 admitidos 2017 (1)2 admitidos 2017 (1)
2 admitidos 2017 (1)
 
Chromosomes, chromatin and cellular cycle
Chromosomes, chromatin and cellular cycle Chromosomes, chromatin and cellular cycle
Chromosomes, chromatin and cellular cycle
 
Bản proposal cho sự kiện ra mắt sản phẩm LG LED
Bản proposal cho sự kiện ra mắt sản phẩm LG LEDBản proposal cho sự kiện ra mắt sản phẩm LG LED
Bản proposal cho sự kiện ra mắt sản phẩm LG LED
 
Liderazgo
LiderazgoLiderazgo
Liderazgo
 
презентация семинар доу
презентация семинар доупрезентация семинар доу
презентация семинар доу
 
S.A.F.E.T Y at Equine Events
S.A.F.E.T Y at Equine EventsS.A.F.E.T Y at Equine Events
S.A.F.E.T Y at Equine Events
 
Daphne_Goris_OT_Resume_2016
Daphne_Goris_OT_Resume_2016Daphne_Goris_OT_Resume_2016
Daphne_Goris_OT_Resume_2016
 
Các phương pháp thai giáo
Các phương pháp thai giáoCác phương pháp thai giáo
Các phương pháp thai giáo
 
Prospecto admision 2017
Prospecto admision 2017Prospecto admision 2017
Prospecto admision 2017
 
Posts
PostsPosts
Posts
 
Social media. How to use?
Social media. How to use?Social media. How to use?
Social media. How to use?
 
Droplet size and velocity characteristics of agricultural sprays
Droplet size and velocity characteristics of agricultural sprays Droplet size and velocity characteristics of agricultural sprays
Droplet size and velocity characteristics of agricultural sprays
 
POPULISMO
POPULISMOPOPULISMO
POPULISMO
 
Evaluation, refinement and development of tractor operated sugarcane cutter p...
Evaluation, refinement and development of tractor operated sugarcane cutter p...Evaluation, refinement and development of tractor operated sugarcane cutter p...
Evaluation, refinement and development of tractor operated sugarcane cutter p...
 
Populismo en américa latina
Populismo en américa latinaPopulismo en américa latina
Populismo en américa latina
 
Design and development of ridge profile power weeder
Design and development of ridge profile power weederDesign and development of ridge profile power weeder
Design and development of ridge profile power weeder
 
Roberto garciajuradosobreelconceptodepopulismo
Roberto garciajuradosobreelconceptodepopulismoRoberto garciajuradosobreelconceptodepopulismo
Roberto garciajuradosobreelconceptodepopulismo
 
Book review
Book reviewBook review
Book review
 
Performance evaluation of weeders in cotton
 Performance evaluation of weeders in cotton Performance evaluation of weeders in cotton
Performance evaluation of weeders in cotton
 

Semelhante a spark-kafka_mod

Kafka Tutorial - Introduction to Apache Kafka (Part 2)
Kafka Tutorial - Introduction to Apache Kafka (Part 2)Kafka Tutorial - Introduction to Apache Kafka (Part 2)
Kafka Tutorial - Introduction to Apache Kafka (Part 2)Jean-Paul Azar
 
Incorta spark integration
Incorta spark integrationIncorta spark integration
Incorta spark integrationDylan Wan
 
Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...
Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...
Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...Denodo
 
Python Kafka Integration: Developers Guide
Python Kafka Integration: Developers GuidePython Kafka Integration: Developers Guide
Python Kafka Integration: Developers GuideInexture Solutions
 
Kafka Streams for Java enthusiasts
Kafka Streams for Java enthusiastsKafka Streams for Java enthusiasts
Kafka Streams for Java enthusiastsSlim Baltagi
 
Using the SDACK Architecture to Build a Big Data Product
Using the SDACK Architecture to Build a Big Data ProductUsing the SDACK Architecture to Build a Big Data Product
Using the SDACK Architecture to Build a Big Data ProductEvans Ye
 
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
Akka Streams And Kafka Streams: Where Microservices Meet Fast DataAkka Streams And Kafka Streams: Where Microservices Meet Fast Data
Akka Streams And Kafka Streams: Where Microservices Meet Fast DataLightbend
 
Kafka and Avro with Confluent Schema Registry
Kafka and Avro with Confluent Schema RegistryKafka and Avro with Confluent Schema Registry
Kafka and Avro with Confluent Schema RegistryJean-Paul Azar
 
What is Apache Kafka®?
What is Apache Kafka®?What is Apache Kafka®?
What is Apache Kafka®?Eventador
 
What is apache Kafka?
What is apache Kafka?What is apache Kafka?
What is apache Kafka?Kenny Gorman
 
Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!
Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!
Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!confluent
 
Streaming Microservices With Akka Streams And Kafka Streams
Streaming Microservices With Akka Streams And Kafka StreamsStreaming Microservices With Akka Streams And Kafka Streams
Streaming Microservices With Akka Streams And Kafka StreamsLightbend
 
Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark Databricks
 
Kafka Tutorial, Kafka ecosystem with clustering examples
Kafka Tutorial, Kafka ecosystem with clustering examplesKafka Tutorial, Kafka ecosystem with clustering examples
Kafka Tutorial, Kafka ecosystem with clustering examplesJean-Paul Azar
 
Stream Processing using Apache Spark and Apache Kafka
Stream Processing using Apache Spark and Apache KafkaStream Processing using Apache Spark and Apache Kafka
Stream Processing using Apache Spark and Apache KafkaAbhinav Singh
 
Sqoop on Spark for Data Ingestion
Sqoop on Spark for Data IngestionSqoop on Spark for Data Ingestion
Sqoop on Spark for Data IngestionDataWorks Summit
 

Semelhante a spark-kafka_mod (20)

Kafka Tutorial - Introduction to Apache Kafka (Part 2)
Kafka Tutorial - Introduction to Apache Kafka (Part 2)Kafka Tutorial - Introduction to Apache Kafka (Part 2)
Kafka Tutorial - Introduction to Apache Kafka (Part 2)
 
Incorta spark integration
Incorta spark integrationIncorta spark integration
Incorta spark integration
 
Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...
Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...
Unlocking the Power of Apache Kafka: How Kafka Listeners Facilitate Real-time...
 
Python Kafka Integration: Developers Guide
Python Kafka Integration: Developers GuidePython Kafka Integration: Developers Guide
Python Kafka Integration: Developers Guide
 
Apache Spark Streaming
Apache Spark StreamingApache Spark Streaming
Apache Spark Streaming
 
Kafka Streams for Java enthusiasts
Kafka Streams for Java enthusiastsKafka Streams for Java enthusiasts
Kafka Streams for Java enthusiasts
 
Using the SDACK Architecture to Build a Big Data Product
Using the SDACK Architecture to Build a Big Data ProductUsing the SDACK Architecture to Build a Big Data Product
Using the SDACK Architecture to Build a Big Data Product
 
Jug - ecosystem
Jug -  ecosystemJug -  ecosystem
Jug - ecosystem
 
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
Akka Streams And Kafka Streams: Where Microservices Meet Fast DataAkka Streams And Kafka Streams: Where Microservices Meet Fast Data
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
 
Kafka and Avro with Confluent Schema Registry
Kafka and Avro with Confluent Schema RegistryKafka and Avro with Confluent Schema Registry
Kafka and Avro with Confluent Schema Registry
 
Chti jug - 2018-06-26
Chti jug - 2018-06-26Chti jug - 2018-06-26
Chti jug - 2018-06-26
 
What is Apache Kafka®?
What is Apache Kafka®?What is Apache Kafka®?
What is Apache Kafka®?
 
What is apache Kafka?
What is apache Kafka?What is apache Kafka?
What is apache Kafka?
 
Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!
Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!
Apache Kafka and KSQL in Action: Let's Build a Streaming Data Pipeline!
 
Streaming Microservices With Akka Streams And Kafka Streams
Streaming Microservices With Akka Streams And Kafka StreamsStreaming Microservices With Akka Streams And Kafka Streams
Streaming Microservices With Akka Streams And Kafka Streams
 
Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark
 
Kafka Tutorial, Kafka ecosystem with clustering examples
Kafka Tutorial, Kafka ecosystem with clustering examplesKafka Tutorial, Kafka ecosystem with clustering examples
Kafka Tutorial, Kafka ecosystem with clustering examples
 
Stream Processing using Apache Spark and Apache Kafka
Stream Processing using Apache Spark and Apache KafkaStream Processing using Apache Spark and Apache Kafka
Stream Processing using Apache Spark and Apache Kafka
 
Sqoop on Spark for Data Ingestion
Sqoop on Spark for Data IngestionSqoop on Spark for Data Ingestion
Sqoop on Spark for Data Ingestion
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 

spark-kafka_mod