Yarn命令详细介绍
[toc]
# yarn命令
# 根据状态查看Yarn全部运行应用程序
# 查看全部运行过的yarn程序
yarn application -list -appStates ALL
# 查看正在运行的yarn程序,等同于:yarn application -list
yarn application -list -appStates RUNNING
1
2
3
4
2
3
4
-appStates
与-list一起使用,可根据输入的逗号分隔的应用程序状态列表来过滤应用程序。有效的应用程序状态可以是以下之一:ALL,NEW,NEW_SAVING,SUBMITTED,ACCEPTED,RUNNING,FINISHED,FAILED,KILLED
# 根据提交程序代码提交类型查看运行程序
# 查看Flink提交到yarn的程序
# yarn application -list -appTypes 'Apache Flink'
Application-Id Application-Name Application-Type User Queue State Final-State Progress Tracking-URL
application_1651044751782_0093 profile-platform Apache Flink hdfs root.users.hdfs RUNNING UNDEFINED 100% http://dev-bigdata-24-149:4681
1
2
3
4
5
6
2
3
4
5
6
-appTypes
# yarn top 查看正在运行的状态
YARN top - 17:03:12, up 13d, 6:24, 0 active users, queue(s): root
NodeManager(s): 3 total, 3 active, 0 unhealthy, 0 decommissioned, 0 lost, 0 rebooted
Queue(s) Applications: 7 running, 119 submitted, 0 pending, 69 completed, 43 killed, 0 failed
Queue(s) Mem(GB): 16 available, 70 allocated, 0 pending, 0 reserved
Queue(s) VCores: 67 available, 29 allocated, 0 pending, 0 reserved
Queue(s) Containers: 29 allocated, 0 pending, 0 reserved
APPLICATIONID USER TYPE QUEUE PRIOR #CONT #RCONT VCORES RVCORES MEM RMEM VCORESECS MEMSECS %PROGR TIME NAME
application_1655951936605_0067 hadoop apache flink default 0 9 0 9 0 26G 0G 1636659 4728125 100.00 02:02:31
application_1655951936605_0120 hadoop apache flink default 0 6 0 6 0 12G 0G 509589 1019188 100.00 00:23:35
application_1655951936605_0122 hadoop apache flink default 0 4 0 4 0 11G 0G 4945 13599 100.00 00:00:20
application_1655951936605_0048 hadoop apache flink default 0 3 0 3 0 9G 0G 1287268 3861784 100.00 04:23:11
application_1655951936605_0121 hadoop apache flink default 0 3 0 3 0 5G 0G 253043 421733 100.00 00:23:25
application_1655951936605_0003 hadoop apache flink default 0 2 0 2 0 3G 0G 2290410 3435610 100.00 13:06:06
application_1655951936605_0002 hadoop apache flink default 0 2 0 2 0 4G 0G 2290768 4581525 100.00 13:06:09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
说明:
参数 | 说明 |
---|---|
#RCONT | 使用的容器container个数 |
RVCORES | 使用的cpu核数 |
RMEM | 使用的内存大小 |
APPLICATIONID | yarn任务ID |
USER | 提交任务用户 |
TYPE | 任务类型,如:apache flink |
QUEUE | 提交任务所在队列 |
# yarn top整体资源使用查看
YARN top - 17:08:52, up 13d, 6:29, 0 active users, queue(s): root
NodeManager(s): 3 total, 3 active, 0 unhealthy, 0 decommissioned, 0 lost, 0 rebooted
Queue(s) Applications: 7 running, 119 submitted, 0 pending, 69 completed, 43 killed, 0 failed
Queue(s) Mem(GB): 16 available, 70 allocated, 0 pending, 0 reserved
Queue(s) VCores: 67 available, 29 allocated, 0 pending, 0 reserved
Queue(s) Containers: 29 allocated, 0 pending, 0 reserved
1
2
3
4
5
6
2
3
4
5
6
参数 | 说明 |
---|---|
available | 剩余可用的资源 |
allocated | 已经使用的资源 |
reserved | 已经申请正在分配的资源 |
pending | 等待申请的资源 |
available + allocated | Yarn的总资源 |
# 指定大小导出数据
yarn logs -applicationId application_1675237371712_0007 --size 10485760
1
- --size 大小单位bytes,1024为1kb,作用在container上
# Yarn web页面
# 工具脚本
# 根据yarn应用名称kill进程
[hadoop@10 /data]$ cat kill.sh
applicationId=`yarn application -list | grep '提交程序在Yarn名称' |awk '{print $1}'`
yarn application -kill $applicationId
yarn application -list
1
2
3
4
2
3
4
# 根据yarn应用名称查看日志
applicationId=`yarn application -list | grep '提交程序在Yarn名称' |awk '{print $1}'`
yarn logs -applicationId $applicationId
1
2
2
上次更新: 2023/05/11, 16:05:55