Flink On Yarn集群搭建
一、环境准备:
1.1 jdk1.8、yarn集群环境
1.2 下载Flink1.15.2
1.3 解压到 /opt/soft/
1.4 下载 flink-shaded-hadoop-2-uber-2.8.3-10.0.jar 并放在/opt/soft/flink1.15.2/lib 下
二、Flink Yarn Session模式启动:
2.1 启动 Yarn Session模式
$ ./flink1.15.2/bin/yarn-session.sh -n 2 -tm 800 -s 1 -d
2.2 停止Yarn Session
$ yarn application -kill appId
2.3 启动 一个Demo测试:
./flink run ../example/batch/WordCount.war
问题:
1、启动yarn session模式的时候,报错:Deployment took more than 60 seconds, Please check if the requested resources are available in the YARN cluster
解决: 在Hadood/et/hadoop目录下修改配置文件 yarn.site.xml,添加配置
<property> <name>yarn.scheduler.minimum-allocation-mb</name> <value>1024</value> </property> <property> <name>yarn.scheduler.maximum-allocation-mb</name> <value>102400</value> </property> <property> <name>yarn.nodemanager.resource.cpu-vcores</name> <value>32</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>51200</value> </property>
<!-- 一台NodeManager的总可用(逻辑)cpu核数 --> <property> <name>yarn.nodemanager.resource.cpu-vcores</name> <value>2</value> </property> <!-- 容器的虚拟内存使用上限:与物理内存的比率 --> <property> <name>yarn.nodemanager.vmem-pmem-ratio</name> <value>2.1</value> </property>
参考:
https://segmentfault.com/a/1190000043033270
https://www.cnblogs.com/jizhong/p/16828300.html