Coder Social home page Coder Social logo

spark-kafka-consumer's Introduction

spark-kafka-consumer

Spark application that consumes Kafka events generated by a Python producer.

Architecture

alt text

How to run

  1. Clone the project
git clone https://github.com/cordon-thiago/spark-kafka-consumer
  1. Set the KAFKA_ADVERTISED_HOST_NAME variable inside the docker-compose.yml with your docker host IP. Note: Do not use localhost or 127.0.0.1 as the host ip if you want to run multiple brokers. More information about the variables you can configure on the kafka docker, please refer to this repository.

  2. Start docker containers with compose.

cd spark-kafka-consumer/docker
docker-compose up -d

It will start the following services:

  • zookeeper:
    • Image: wurstmeister/zookeeper
    • Port: 2181
  • kafka:
    • Image: wurstmeister/kafka:2.11-1.1.1
    • Port: 9092
  • spark:
    • Image: jupyter/all-spark-notebook
    • Port: 8888
  1. Get the Jupyter Notebook URL + Token accessing the spark container

Access the container bash

docker exec -it docker_spark_1 bash

Then, get the notebook URL. Copy and paste the URL in the browser.

jupyter notebook list
  1. Run the event-producer.ipynb notebook to start producing events from changes in Wikipedia pages to a Kafka topic. More information about the Wikipedia event here.

  2. Run the event-consumer-spark.ipynb notebook to start consuming events from the Kafka topic and write it in parquet files.

  3. Run the data-visualization.ipynb notebook to read the parquet files as streaming and visualize the top 10 users that have more edits.

spark-kafka-consumer's People

Contributors

cordon-thiago avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.