Flink基础

news/2024/7/24 11:40:54 标签: flink, 大数据

Flink
architecture
job manager is master
task managers are workers
task slot is a unit of resource in cluster, number of slot is equal to number of cores(超线程则slot=2*cores), slot=一组内存+一些线程+共享CPU
when starting a cluster,job manager will allocate a certaion number of slots to each taskManager in cluster,
each slots can run one parallel instance of a task or operator
tasks as a basic unit of work execution physically
each task corresponds to a logical reperesentation of data processiong (entire job chain excution )
a subtask represents some operators physically. which is concrete and excutable with other subtasks run in paralle in the same task slot,Flink will process the excution by chaining compatible oeprators if can be chained in same slot to reduce data shuffling
Subtask 是 Flink 作业中 Operator 的并行实例。每个 Operator 都可以拥有一个或多个 subtask,这些 subtask 是并行执行的,运算符子任务(subtask)的数量是该特定运算符的并行度
subtask scheduling
if parallelism is 6, six parallel instances will go across the available task slots.
Flink will process the excution by chaining compatible oeprators if can be chained in same slot to reduce data shuffling
if key by,then all data with same key will be processed in the same slot for accurate state management
**key by group by or window operation need data shuffling(**data movement between nodes)

Image

operator会被chain在同一subtask的情况
(1)手动设置setChainingStrategy(ChainingStrategy.ALWAYS)
.map(x => x * 2)
.filter(x => x > 2)
.setChainingStrategy(ChainingStrategy.ALWAYS)
(2)keyby分区后,相同数据的后续所有操作都在同一个subtask中
keyBy(keySelector).map(…).filter(…) .print();
(3)并行度相同的operators通常可能被chain在一起减少data shuffling
flink Window窗口
在一个无界流中设置起始位置和终止位置,让无界流变成有界流,并且在有界流中进行数据处理,流批转化

  • window窗口在无界流中设置起始位置和终止位置的方式可以有两种 ,基于时间或者基于窗口数据量,
  • 分组和未分组窗口。自定义窗口
  • 时间窗口:
  • 滚动窗口: 数据不重复
  • 滑动窗口:数据有重复
  • 窗口聚合函数:
  • 增量聚合:ReduceFunction、AggregateFunction
  • 全量聚合 ProcessWindowFunction、WindowFunction属于全量窗口函数

http://www.niftyadmin.cn/n/5003960.html

相关文章

Python数据分析-Pandas

Pandas 个人笔迹,建议不看 import pandas as pd import numpy as npSeries类型 spd.Series([1,3,5,np.nan,6,8],index[a,b,c,d,e]) print(s) # 默认0-n-1,否则用index数组作行标 s.index s.value # array() s[a] &g…

最低通行费(数-根)

思路: (1)注意到时间要求为2N - 1,等价于只能往右或者往下走。 (2)于是用f[i][j]描述走到(i,j)的最小代价,由于只能从左或者上到达,故取最小即可。 (3&…

centos8.0安装mysql8

下载mysql 使用weget下载mysql: wget https://repo.mysql.com/mysql80-community-release-el6-1.noarch.rpm安装启动mysql rpm -ivh mysql80-community-release-el6-1.noarch.rpm下载mysql yum -y install mysql-server启动mysql systemctl start mysqld初始化…

详解Spring Boot中@PostConstruct的使用

PostConstruct 在Java中,PostConstruct是一个注解,通常用于标记一个方法,它表示该方法在类实例化之后(通过构造函数创建对象之后)立即执行。 加上PostConstruct注解的方法会在对象的所有依赖项都已经注入完成之后执行…

How to clean up Graylog Default index set log

一、前言: Graylog 满了,没有自动清理 挤爆硬盘空间,手动清理流程: 二、问题描述: Elasticsearch nodes disk usage above high watermark (triggered a few seconds ago)mree are ast search modes i the use wtm a mos mo re disk ther dsk s saoe me e waemak f ths…

Java API速记手册(持续更新ing...)

诸神缄默不语-个人CSDN博文目录 之所以干这个事原因也很简单,因为我3年没写Java了,现在在复健。 因为我最近都在用Python,所以跟Python一样的部分我就不写了。 最基本的框架public class MainClass {public static void main(String[] args…

原创AJAX + PHP 编辑器内容自动备份草稿保存到本地 (适用ueditor百度编辑器或其它) 内容变化后自动触发备份txt文件

百度自带的自动备份功能enableAutoSave存在问题, 比如第一个文章他自动备份了.等发表第二个文章时,结果把第一个文章的内容自动填充进去了.关键你还不知情!出现过多次这种情况了. 一, 百度原版的 ,具体使用方法,看这里个文章 Ueditor百度编辑器内容自动保存到本地防数据丢失 …

Android Studio更新新版本后无法创建flutter项目

最新更新了AndroidStudio版本,发现无法创建flutter项目。 dart和flutter插件确认都已安装,该有的环境配置都已配置。 最后与同事的插件作比较发现是Android APK Support这个插件没勾选。 勾选后,点击右下角的apply,重启AndroidS…