当前位置: 首页 > 工具软件 > application > 使用案例 >

yarn application 命令列表

徐秋月
2023-12-01

一、yarn application 命令概览

命令参数说明
-appStates Works with -list to filter applications based on input comma-separated list of application states. The valid application state can be one of the following:ALL,NEW,NEW_SAVING,SUBMITTED,ACCEPTED,RUNNING,FINISHED,FAILED,KILLED
-appTypes Works with -list to filter applications based on input comma-separated list of application types.
-helpDisplays help for all commands.
-kill <Application ID>Kills the application.
-listList applications. Supports optional use of -appTypes to filter applications based on application type, and -appStates to filter applications based on application state.
-movetoqueue <Application ID>Moves the application to a different queue.
-queue <Queue Name>Works with the movetoqueue command to specify which queue to move an application to.
-status <Application ID>Prints the status of the application.

二、命令详情

2.1 -list

说明:列出所有 Application

yarn  application -

2.2 -appStates

说明:-appStates 一般都是跟 -list 一起使用,用来筛选不同状态的 application,多个用","分隔;
所有状态:ALL,NEW,NEW_SAVING,SUBMITTED,ACCEPTED,RUNNING,FINISHED,FAILED,KILLED

yarn  application -list -appStates RUNNING

2.3 -appTypes

说明:-appTypes 一般都是跟 -list 一起使用,用来筛选不同类型的 application,多个用","分隔; 如 SPARK、MAPREDUCE

yarn  application -list -appTypes SPARK,MAPREDUCE

2.4 -kill

说明:杀掉一个 Application,需要传递application-id

yarn  application -kill application_1602323335342_116447

2.5 -status

说明:列出 application 的执行状态 ,需要传递application-id

yarn  application -status application_1602323335342_116447

打印内容大致如下:

20/11/07 10:02:53 INFO client.RMProxy: Connecting to ResourceManager at cdh01.hadoop.com/111.111.111.111:8032
Application Report :
Application-Id : application_1602323335342_116447
Application-Name : com.david.report.BigWorldModel
Application-Type : SPARK
User : hdfs
Queue : root.users.hdfs
Start-Time : 1606560468390
Finish-Time : 0
Progress : 10%
State : RUNNING
Final-State : UNDEFINED
Tracking-URL : http://cdh07.hadoop.com:34004
RPC Port : 0
AM Host : 111.111.111.118
Aggregate Resource Allocation : 3194665681 MB-seconds, 1559894 vcore-seconds
Log Aggregation Status : NOT_START
Diagnostics :

2.6 -movetoqueue

说明:移动 application 到其他的 queue,不能单独使用,并需要具备相关权限

yarn  application -

2.7 -queue

说明:与 movetoqueue 命令一起使用,指定移动到哪个 queue

yarn  application -movetoqueue application_1602323335342_116447 -queue another_queue

2.8 yarn logs -applicationId 命令后跟具体application-id

说明:查看application的日志信息

yarn logs -applicationId application_1602323335342_116447

2.9 yarn node -list

说明:查看节点清单,显示nn/dn列表

yarn node -list

20/11/07 10:13:07 INFO client.RMProxy: Connecting to ResourceManager at cdh01.hadoop.com/111.111.111.111:8032
Total Nodes:10
         Node-Id	     Node-State	Node-Http-Address	Number-of-Running-Containers
cdh05.hadoop.com:8041	        RUNNING	cdh05.hadoop.com:8042	                           0
cdh06.hadoop.com:8041	        RUNNING	cdh06.hadoop.com:8042	                           0
cdh08.hadoop.com:8041	        RUNNING	cdh08.hadoop.com:8042	                           0
cdh07.hadoop.com:8041	        RUNNING	cdh07.hadoop.com:8042	                           1
cdh04.hadoop.com:8041	        RUNNING	cdh04.hadoop.com:8042	                           1
cdh01.hadoop.com:8041	        RUNNING	cdh01.hadoop.com:8042	                           0
cdh02.hadoop.com:8041	        RUNNING	cdh02.hadoop.com:8042	                           0
cdh03.hadoop.com:8041	        RUNNING	cdh03.hadoop.com:8042	                           0
cdh09.hadoop.com:8041	        RUNNING	cdh09.hadoop.com:8042	                           0
cdh10.hadoop.com:8041	        RUNNING	cdh10.hadoop.com:8042	                           6

2.10 yarn queue -status ${QUEUE_NAME}

说明:查看节点清单,显示nn/dn列表

yarn queue -status root.users.hdfs
20/11/07 10:19:23 INFO client.RMProxy: Connecting to ResourceManager at cdh01.hadoop.com/111.111.111.111:8032
Queue Information : 
Queue Name : root.users.hdfs
	State : RUNNING
	Capacity : 50.0%
	Current Capacity : 4.2%
	Maximum Capacity : -100.0%
	Default Node Label expression : 
	Accessible Node Labels : 

2.11 yarn top -delay 10

说明:查看集群中各个任务的资源使用信息

yarn top -delay 10

YARN top - 10:24:20, up 56d, 16:35, 0 active users, queue(s): root
NodeManager(s): 10 total, 10 active, 0 unhealthy, 0 decommissioned, 0 lost, 0 rebooted
Queue(s) Applications: 3 running, 136358 submitted, 0 pending, 136332 completed, 12 killed, 11 failed
Queue(s) Mem(GB): 0 available, 12 allocated, 0 pending, 0 reserved
Queue(s) VCores: 0 available, 6 allocated, 0 pending, 0 reserved
Queue(s) Containers: -2 allocated, -2 pending, -2 reserved

                  APPLICATIONID USER             TYPE      QUEUE   #CONT  #RCONT  VCORES RVCORES     MEM    RMEM  VCORESECS    MEMSECS %PROGR       TIME NAME                                
application_1602323335342_136385 hdfs            spark root.users.hdfs       3       0       3       0      6G      0G         56        114  10.00   00:00:00 com.david.report.PVUVTotal
application_1602323335342_116447 hdfs            spark root.users.hdfs       2       0       2       0      4G      0G    1562467    3124937  10.00   08:15:36 com.david.report.GMVModel
application_1602323335342_136387 hdfs            spark root.users.hdfs       1       0       1       0      2G      0G          0          0   0.00   00:00:00 com.david.yesreport.MonthDAUTotal
 类似资料: