Code Monkey home page Code Monkey logo

apache-flink's Introduction

apache-flink

Repo for learning about Apache Flink

DevOps

DevOps is prepared for Kubernetes.

Pre-requisites:

  • minikube (local development)
  1. Create Flink cluster
kubectl apply -f devops

Note:

There is only one instance of job-manager since it's assumed that k8s will restart it automatically.

However after restart of job-manager info about jobs is lot and must be restored manually.

So if failure recovery should be supported for job-manager then cluster of job-managers must be created using Zookeeper.

Task managers can be auto-scaled and will be managed by job-manager.

More details can be found in presentation.

Dashboard management

  1. Run k8s proxy
kubectl proxy
  1. Enter the UI

or check URL of job-manager service:

kubectl get service flink-jobmanager

or for minikube @ localhost:

minikube service --url flink-jobmanager

Local development

Pre-requisites:

  • Scala

  • Sbt

sbt run

or to build:

sbt package

Samples

Sockets

You can run socket-based samples as following:

  1. Open socket
nc -l 9000
  1. Start job

Kafka

You can run Kafka-based samples as following:

docker-compose up

Other commands:

kafka-avro-console-consumer --topic song-feed --bootstrap-server localhost:9092 --from-beginning
kafka-topics --list --zookeeper localhost:32181

Deployment

Manual deployment using UI

  1. Go to UI console -> Submit new job

  2. Upload jar

  3. Run uploaded jar with chosen main class (i.e. com.mwronski.flink.batch.BatchWordCount)

Automated deployment

Before automating you might want to check configuration and blob.* properties (especially blob.storage.directory - directory for storing blobs (such as user JARs) on the TaskManagers).

This section describes how to run task using REST API.

Note: All below steps should be placed in bash script for automation purposes.

  1. Deploy JAR file
curl -v -F  [email protected] http://192.168.99.100:31273/jars/upload
  1. Get ID of uploaded JAR File
curl http://192.168.99.100:31273/jars
  1. Run task based on found ID of a JAR file
curl -XPOST http://192.168.99.100:31273/jars/5935d344-c7a8-44ed-898e-8a005262ecc5_a.jar/run?entry-class=com.mwronski.flink.batch.BatchWordCount
  1. Check job status
curl http://192.168.99.100:31273/jobs

Documents

apache-flink's People

Contributors

m-wrona avatar

Watchers

 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.