集群机器
创建三台机器node101,node102,node103
附加组件
https://flink.apache.org/downloads.html
启动集群-Hadoop
假设已经部署和启动好Hadoop集群

不启动Flink-YARN-Session
## 不启动 yarn-session.sh## [java@node101 bin]$ ./yarn-session.sh -n 2 -s 2 -jm 1600 -tm 1024 -nm flinkapp -d
NC监听
[java@node101 bin]$ nc -lkv 7777Ncat: Version 7.70 ( https://nmap.org/ncat )Ncat: Listening on :::7777Ncat: Listening on 0.0.0.0:7777
提交任务
[java@node101 bin]$ ./flink run -m yarn-cluster -c online.javabook.flink.quickstart.SocketWordCount /opt/module/flink-jobs/javabook.apache.flink-1.0-SNAPSHOT.jar --host 192.168.89.101 --port 77772021-07-19 19:02:30,959 WARN org.apache.flink.yarn.configuration.YarnLogConfigUtil [] - The configuration directory ('/opt/module/flink-1.13.1/conf') already contains a LOG4J config file.If you want to use logback, then please delete or rename the log configuration file.2021-07-19 19:02:31,113 INFO org.apache.hadoop.yarn.client.RMProxy [] - Connecting to ResourceManager at node102/192.168.89.102:80322021-07-19 19:02:31,337 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - No path for the flink jar passed. Using the location of class org.apache.flink.yarn.YarnClusterDescriptor to locate the jar2021-07-19 19:02:31,814 WARN org.apache.flink.yarn.YarnClusterDescriptor [] - Neither the HADOOP_CONF_DIR nor the YARN_CONF_DIR environment variable is set. The Flink YARN Client needs one of these to be set to properly load the Hadoop configuration for accessing YARN.2021-07-19 19:02:31,992 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - The configured JobManager memory is 1600 MB. YARN will allocate 2048 MB to make up an integer multiple of its minimum allocation memory (1024 MB, configured via 'yarn.scheduler.minimum-allocation-mb'). The extra 448 MB may not be used by Flink.2021-07-19 19:02:31,993 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - The configured TaskManager memory is 1728 MB. YARN will allocate 2048 MB to make up an integer multiple of its minimum allocation memory (1024 MB, configured via 'yarn.scheduler.minimum-allocation-mb'). The extra 320 MB may not be used by Flink.2021-07-19 19:02:31,993 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - Cluster specification: ClusterSpecification{masterMemoryMB=1600, taskManagerMemoryMB=1728, slotsPerTaskManager=2}2021-07-19 19:02:45,828 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - Submitting application master application_1626692284287_00012021-07-19 19:02:47,225 INFO org.apache.hadoop.yarn.client.api.impl.YarnClientImpl [] - Submitted application application_1626692284287_00012021-07-19 19:02:47,225 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - Waiting for the cluster to be allocated2021-07-19 19:02:47,230 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - Deploying cluster, current state ACCEPTED2021-07-19 19:03:19,572 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - YARN application has been deployed successfully.2021-07-19 19:03:19,573 INFO org.apache.flink.yarn.YarnClusterDescriptor [] - Found Web Interface node102:39069 of application 'application_1626692284287_0001'.Job has been submitted with JobID 3f9f08072db5596d7d70460da206c637
查看YARN
http://node102:8088/cluster/apps



