Git Product home page Git Product logo

naveenkumar129 / explore-kafkaflink-berlin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from felipegutierrez/explore-flink

1.0 0.0 0.0 29.15 MB

This project uses Apache Flink as a stream engine that consumes data from the File system or Kafka brokers and exposes metrics using Prometheus and Grafana, everything deployed on Kubernetes (minikube).

Shell 1.41% Java 97.38% Scala 0.69% Dockerfile 0.51%

explore-kafkaflink-berlin's Introduction

Java CI with Maven Run Test Suites codecov CodeFactor Codacy Badge CodeQL GitHub issues GitHub closed issues Docker Image Size (latest by date) Lines of code

This project is based on Apache Flink 1.13.1 consuming events from Kafka 2.2.5 (using Strimzi operators) with Docker 19.03.8, Kubernetes v1.19.0, minikube v1.13.1, Java 8, and Scala 2.12. The docker images can be found at Docker Hub.

1. Kubernetes + Docker + Kafka & Zookeeper (3 brokers & 3 zookeepers from Strimzi operators) + Flink(1 JobManager & 3 TaskManagers) + Prometheus + Grafana

This section aims to use Flink consuming data from Kafka and from a filesystem, exporting data to Promethues and displaying it at Grafana dashboard. It is based on the official tutorial Flink with Kubernetes Setup.

minikube start --cpus 4 --memory 8192

First configure Kafka using the Strimzi operators based on this file. Then, apply the other yaml files available on directory k8s/.

minikube ssh 'sudo ip link set docker0 promisc on'
kubectl proxy
kubectl apply -n kafka -f k8s/

Use the minikube IP address minikube ip to access the Flink UI-Web at http://172.17.0.2:30081, the Prometheus WebUI at http://172.17.0.2:30091/targets and http://172.17.0.2:30091/graph, and the Grafana WebUI at http://172.17.0.2:30011.

Overview of this project in action

Kafka(Strimzi) - Flink web UI - prometheus - grafana - using Kubernetes

Troubleshooting

Testing Kafka client:

$ kubectl exec -it kafka-client -- /bin/bash
root@kafka-client:/# cd /usr/bin/
root@kafka-client:/usr/bin# kafka-topics --list --zookeeper zookeeper:2181
__confluent.support.metrics

List the objects, the resources:

kubectl get all
kubectl api-resources

Logs:

kubectl describe pod <POD_ID>
kubectl logs <POD_ID>
kubectl exec -i -t <POD_ID> -- /bin/bash
kubectl -n kube-system top pods
kubectl get nodes
kubectl top nodes
kubectl get pods -A
kubectl top pods

Clean your Kubernetes cluster and delete everything when you finish to test.

kubectl delete statefulset flink-taskmanager kafka zookeeper
kubectl delete jobs flink-jobmanager tpch-dbgen-job
kubectl delete deployments kafka-broker grafana-deployment prometheus-deployment tpch-dbgen-deployment
kubectl delete services zookeeper kafka flink-jobmanager flink-jobmanager-rest flink-taskmanager prometheus-service-rest prometheus-service grafana-service-rest grafana-service
kubectl delete pvc tpch-dbgen-data-pvc tpch-dbgen-datarate-pvc
kubectl delete configmaps flink-config grafana-config prometheus-config
kubectl delete pods kafka-client

minikube stop

2. Docker + Kafka(1 ZooKeeper, 1 broker) + Flink(1JobManager, 3TaskManagers) + Prometheus + Grafana

This section is here only to help if one would like to not use Kubernetes and deploy Flink only using Docker.

cd operations-playground
docker-compose build --no-cache
docker-compose up -d --remove-orphans
docker-compose ps -a
                    Name                                  Command               State                   Ports                
-----------------------------------------------------------------------------------------------------------------------------
operations-playground_clickevent-generator_1   /docker-entrypoint.sh java ...   Up       6123/tcp, 8081/tcp                  
operations-playground_client_1                 /docker-entrypoint.sh flin ...   Exit 0                                       
operations-playground_jobmanager_1             /docker-entrypoint.sh jobm ...   Up       6123/tcp, 0.0.0.0:8081->8081/tcp    
operations-playground_kafka_1                  start-kafka.sh                   Up       0.0.0.0:9094->9094/tcp              
operations-playground_taskmanager-01_1         /docker-entrypoint.sh task ...   Up       6123/tcp, 8081/tcp                  
operations-playground_taskmanager-02_1         /docker-entrypoint.sh task ...   Up       6123/tcp, 8081/tcp                  
operations-playground_taskmanager-03_1         /docker-entrypoint.sh task ...   Up       6123/tcp, 8081/tcp                  
operations-playground_zookeeper_1              /bin/sh -c /usr/sbin/sshd  ...   Up       2181/tcp, 22/tcp, 2888/tcp, 3888/tcp

Stop the images:

docker-compose down

Troubleshooting

docker-compose logs clickevent-generator|client|kafka|zookeeper|jobmanager|taskmanager-01|taskmanager-02|taskmanager-03
docker-compose images
docker container prune
docker system prune
docker image ls
docker image rm ID
docker run -i -t felipeogutierrez/tpch-dbgen /bin/bash

explore-kafkaflink-berlin's People

Contributors

codacy-badger avatar dependabot[bot] avatar felipegutierrez avatar

Stargazers

 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.