Giter Site home page Giter Site logo

0xqq / kafka-spark-flink-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidcampos/kafka-spark-flink-example

0.0 1.0 0.0 16 KB

Kafka streaming with Spark and Flink example

License: MIT License

Dockerfile 3.00% Java 74.51% Shell 22.50%

kafka-spark-flink-example's Introduction

Kafka streaming with Spark and Flink example

Example project on how to use Apache Kafka and streaming consumers, namely:

  • Producer sending random number words to Kafka
  • Consumer using Kafka to output received messages
  • Streaming Consumer using Apache Spark to count words occurrences
  • Streaming Consumer using Apache Flink to count words occurrences

Requirements

  • Docker
  • Docker Compose
  • Java 8
  • Maven

Build

  1. Build Java project
    mvn clean package
    
  2. Build Docker image
    docker build -t kafka-spark-flink-example .
    

Run

  1. Start docker containers
    docker-compose up -d
    

Check

  1. Check producer logs

    docker logs kafka-spark-flink-example_kafka-producer_1 -f
    

    Output should be similar to:

    [main] INFO  org.davidcampos.kafka.producer.KafkaProducerExample - Sent (74b23319-084c-4309-80a7-c0d6f107a092, eight) to topic example @ 1525127107909.
    
  2. Check consumer with Spark logs

    docker logs kafka-spark-flink-example_kafka-consumer-spark_1 -f
    

    Output should be similar to:

    (two,3)
    (one,3)
    (nine,5)
    (six,8)
    (three,2)
    (five,2)
    (four,9)
    (seven,3)
    (eight,6)
    (ten,6)
    
  3. Check consumer with Flink logs

    docker logs kafka-spark-flink-example_kafka-consumer-flink_1 -f
    

    Output should be similar to:

    1> (ten,85)
    4> (nine,104)
    1> (ten,86)
    4> (five,91)
    4> (one,94)
    4> (six,90)
    1> (three,89)
    4> (six,91)
    4> (five,92)
    

Kafka Web UI

Kafka Manager Web UI available at http://localhost:9000.

Spark Web UI

Spark Web UI available at http://localhost:4040.

Stop

  1. Stop docker containers
    docker-compose down
    

kafka-spark-flink-example's People

Contributors

davidcampos avatar

Watchers

 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.