Git Product home page Git Product logo

stream-processing-docker-tutorial's Introduction

Lab 8: Setup Flink and Kafka Clusters using Docker

Flink

Reference: https://hub.docker.com/_/flink

Running a JobManager or a TaskManager

You can run a JobManager (master).

$ docker run --name flink_jobmanager -d -t flink jobmanager

NB: if you have already the container created, the above command will lead to an error like below: docker: Error response from daemon: Conflict. The container name "/flink_jobmanager" is already in use by container "32523f311c747cf6b0c0744d9edda2788af2213da189cd7926f60a4192073ce8". You have to remove (or rename) that container to be able to reuse that name. In this case, run

docker start flink_jobmanager

You can also run a TaskManager (worker). Notice that workers need to register with the JobManager directly or via ZooKeeper so the master starts to send them tasks to execute.

$ docker run --name flink_taskmanager -d -t flink taskmanager

Running a cluster using Docker Compose

With Docker Compose you can create a Flink cluster:

version: "2.1"
services:
  jobmanager:
    image: ${FLINK_DOCKER_IMAGE_NAME:-flink}
    expose:
      - "6123"
    ports:
      - "8081:8081"
    command: jobmanager
    environment:
      - JOB_MANAGER_RPC_ADDRESS=jobmanager

  taskmanager:
    image: ${FLINK_DOCKER_IMAGE_NAME:-flink}
    expose:
      - "6121"
      - "6122"
    depends_on:
      - jobmanager
    command: taskmanager
    links:
      - "jobmanager:jobmanager"
    environment:
      - JOB_MANAGER_RPC_ADDRESS=jobmanager

and just run docker-compose -f docker-compose-flink.yml up --no-recreate.

Scale the cluster up or down to N TaskManagers:

docker-compose -f docker-compose-flink.yml up --scale taskmanager=<N> --no-recreate

E.g.,

docker-compose -f docker-compose-flink.yml up --scale taskmanager=3 --no-recreate

Submit a job

From the command line

$ flink run  -c io.github.streamingwithflink.chapter1.AverageSensorReadings examples-scala_2.12-1.0.jar

From browser

  • open http://localhost:8081/#/submit
  • upload the jar file examples-scala_2.12-1.0.jar
  • specify the Entry Class io.github.streamingwithflink.chapter1.AverageSensorReadings
  • Submit

Kafka

Running a Kafka cluster using Docker Compose

https://hub.docker.com/r/bitnami/kafka/

$ docker-compose -f docker-compose-kafka.yml up --no-recreate

Or use the Confluent Docker setup

https://docs.confluent.io/current/quickstart/ce-docker-quickstart.html

Reference:

stream-processing-docker-tutorial's People

Contributors

ghxiao avatar

Watchers

James Cloos avatar  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.