一泌霍、概述
Flink's distributed execution consists of two important processes, master and worker. When a Flink program is executed, various processes take part in the execution, namely Job Manager, Task Manager, and Job Client.
Flink程序需要提交給Job Client。然后,Job Client將作業(yè)提交給Job Manager。Job Manager負(fù)責(zé)協(xié)調(diào)資源分配和作業(yè)執(zhí)行。它首先要做的是分配所需的資源洽腺。資源分配完成后,任務(wù)將提交給相應(yīng)的Task Manager覆旱。當(dāng)接收到任務(wù)時(shí)蘸朋, Task Manager啟動(dòng)一個(gè)線程以開始執(zhí)行。執(zhí)行到位時(shí)扣唱,Task Manager會(huì)繼續(xù)向Job Manager報(bào)告狀態(tài)更改藕坯⊥拍希可以有各種狀態(tài),例如開始執(zhí)行炼彪,正在進(jìn)行或已完成吐根。作業(yè)執(zhí)行完成后,結(jié)果將發(fā)送回客戶端辐马。
二拷橘、Job Manager
- The master processes, also known as Job Managers, coordinate and manage the execution of the program. Their main responsibilities include scheduling tasks, managing checkpoints, failure recovery, and so on.
- There can be many Masters running in parallel and sharing these responsibilities. This helps in achieving high availability. One of the masters needs to be the leader. If the leader node goes down, the master node (standby) will be elected as leader.
- The Job Manager consists of the following important components:
- 1、Actor system
- 2喜爷、Scheduler
- 3冗疮、Check pointing
- Flink internally uses the Akka actor system for communication between the Job Managers and the Task Managers.
2.1: Actor system(參與者系統(tǒng))
- An actor system is a container of actors with various roles. It provides services such as scheduling, configuration, logging, and so on. It also contains a thread pool from where all actors are initiated. All actors reside in a hierarchy. Each newly created actor would be assigned to a parent. Actors talk to each other using a messaging system. Each actor has its own mailbox from where it reads all the messages. If the actors are local, the messages are shared through shared memory but if the actors are remote then messages are passed thought RPC calls.
Actor system是具有各種角色的actor的容器。它提供諸如調(diào)度檩帐,配置术幔,日志記錄等服務(wù)。它還包含一個(gè)啟動(dòng)所有actor的線程池湃密。所有actors都位于層次結(jié)構(gòu)中诅挑。每個(gè)新創(chuàng)建的actor都將分配給父級(jí)。actor使用消息傳遞系統(tǒng)相互交談勾缭。每個(gè)actor都有自己的郵箱揍障,從中讀取所有郵件。如果actor是本地的俩由,則消息通過共享內(nèi)存共享毒嫡,但如果actor是遠(yuǎn)程的,則通過RPC調(diào)用傳遞消息幻梯。
- Each parent is responsible for the supervision of its children. If any error happens with the children, the parent gets notified. If an actor can solve its own problem then it can restart its children. If it cannot solve the problem then it can escalate the issue to its own parent:
每位家長(zhǎng)負(fù)責(zé)監(jiān)督其子女兜畸。如果children發(fā)生任何錯(cuò)誤,父母會(huì)收到通知碘梢。如果actor可以解決自己的問題咬摇,那么它可以重新啟動(dòng)它的子節(jié)點(diǎn)。如果它無(wú)法解決問題煞躬,那么它可以將問題升級(jí)到自己的父級(jí):
- In Flink, an actor is a container having state and behavior. An actor's thread sequentially keeps on processing the messages it will receive in its mailbox. The state and the behavior are determined by the message it has received.
在Flink中肛鹏,actor是具有狀態(tài)和行為的容器。 actor的線程依次持續(xù)處理它將在其郵箱中接收的消息恩沛。其狀態(tài)和行為由它收到的消息決定在扰。