【Flink学习笔记】02、flink集群安装部署

一、standalone模式

1、上传flink到cdh01节点,并解压

tar -zxvf flink-1.10.0-bin-scala_2.11.tgz -C /opt/module

2、修改配置文件

cd /opt/module/flink-1.10.0/conf/
vim flink-conf.yaml

修改一下下面的几个参数,我这内存比较多,直接加了个0:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127205037692.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)

修改slaves文件:

cdh01
cdh02
cdh03

修改masters文件:

cdh01:8081

3、分发到其它两台节点

scp -r flink-1.10.0/ root@cdh02:`pwd`
scp -r flink-1.10.0/ root@cdh03:`pwd`

4、启动:

[root@cdh01 bin] ./start-cluster.sh

在cdh01 jps,有两个进程

86721 TaskManagerRunner
86368 StandaloneSessionClusterEntrypoint

5、访问webui:

http://192.168.66.11:8081/#/overview
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127210325718.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
6、使用webui提交程序

先打包:![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127211048541.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
点击add New:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127211149642.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
上传之后的效果:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127211352656.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
在cdh01启动netcat:

nc -lk 7777

双击jar包名称并且填写主类:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127211956246.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
点击提交任务之后的效果:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127212051963.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)

上面的图有两条任务链

输入数据流:
在这里插入图片描述
那么在哪里看 结果呢?

点击最后一个任务链:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127212658786.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
可知它在cdh01,我的ip是11结尾:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127212853204.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)
点进去即可找到结果输出:
![在这里插入图片描述]( https://img-blog.csdnimg.cn/20210127212940961.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MDIzOTI4,size_16,color_FFFFFF,t_70)

二、flink并行度和slot

  • slot是静态的概念,是指taskManager具有的并发执行能力
  • parallelism是动态的概念,是指应用 程序实际使用的并发能力

建议slot的数量和CPU的核数保持一致

一个slot就是一个线程

并行度可以在四个层面进行设置:

  • 算子层面
  • 执行环境层面
  • 客户端层面
  • 系统层面

二、yarn模式

posted @ 2021-01-27 22:00  沉淀技术这十年  阅读(283)  评论(0)    收藏  举报