FLINK on YARN模式
解壓安裝包:
tar -zvxf flink-1.12.2-bin-scala_2.11.tgz /opt/
修改yarn配置,設定application master重新開機時嘗試的最大次數(cdh内有此參數,預設是2):
<property>
<name>yarn.resourcemanager.am.max-attempts</name>
<value>10</value>
<description>
The maximum number of application master execution attempts.
</description>
配置flink-conf.yaml檔案(有些配置已存在,隻需要修改參數)
cd /opt/flink-1.12.2/conf/
vi flink-conf.yaml
taskmanager.memory.process.size: 8192m
taskmanager.memory.managed.fraction: 0.2
jobmanager.memory.process.size: 2048m
taskmanager.numberOfTaskSlots: 3
cluster.evenly-spread-out-slots: true
parallelism.default: 10
high-availability: zookeeper
high-availability.storageDir: hdfs:///flink/ha
high-availability.zookeeper.quorum: node1:2181,node2:2181,node3:2181
high-availability.zookeeper.path.root: /flink
yarn.application-attempts: 5
rest.port: 8085
web.submit.enable: true
io.tmp.dirs: /tmp
classloader.resolve-order: parent-first
classloader.check-leaked-classloader: false
state.backend: rocksdb
execution.checkpointing.interval: 30000
state.checkpoints.dir: hdfs:///flink/checkpoints
state.checkpoints.num-retained: 10
state.savepoints.dir: hdfs:///flink/savepoints
state.backend.incremental: true
historyserver.web.port: 8082
historyserver.archive.fs.refresh-interval: 10000
jobmanager.execution.failover-strategy: region
修改zoo.cfg:
vi zoo.cfg
#添加zookeeper叢集
server.1=node1:2888:3888
server.2=node2:2888:3888
server.3=node3:2888:3888
配置環境變量:
vi /etc/profile
export FLINK_HOME=/opt/flink-1.12.2
export PATH=$FLINK_HOME/bin:$PATH
export HADOOP_CLASSPATH=`hadoop classpath`
source /etc/profile
測試
FLINK on YARN示例:
yarn-session模式:
#啟動成功後,在yarn叢集檢視,名字是test
bin/yarn-session.sh -nm test -d
#啟動flinksql用戶端
bin/sql-client.sh embedded -s test