Yarn常用命令

1、Yarn application查看任务

(1)列出所有 Application

[yasin@hadoop102 hadoop-3.1.3]$ yarn application -list

2021-08-09 16:08:29,196 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of applications (application-types: [], states: [SUBMITTED, ACCEPTED, RUNNING] and tags: []):0
                Application-Id	    Application-Name	    Application-Type	      User	     Queue	             State	       Final-State	       Progress	                       Tracking-URL

(2)根据 Application 状态过滤:yarn application -list -appStates (所有状态:ALL、NEW、
NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED)

[yasin@hadoop102 hadoop-3.1.3]$ yarn application -list -appStates FINISHED

2021-08-09 16:29:49,661 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of applications (application-types: [], states: [FINISHED] and tags: []):1
                Application-Id	    Application-Name	    Application-Type	      User	     Queue	             State	       Final-State	       Progress	                       Tracking-URL
application_1628495545961_0001	          word count	           MAPREDUCE	     yasin	   default	          FINISHED	         SUCCEEDED	           100%	http://hadoop102:19888/jobhistory/job/job_1628495545961_0001

(3)Kill Application

[yasin@hadoop102 hadoop-3.1.3]$ yarn  application  -kill application_1628495545961_0001

2021-08-09 17:32:52,514 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Application application_1628495545961_0001 has already finished 

2、Yarn logs 查看日志

(1)查看Application日志

yarn  logs  -applicationId application_1628495545961_0002

(2)查看Container日志

yarn  logs  -applicationId application_1628495545961_0002 -containerId  application_1628495545961_0002_01_000001

3、Yarn applicationattempt 查看尝试运行的任务

(1)列出所有 Application 尝试的列表:yarn applicationattempt -list

[yasin@hadoop102 hadoop-3.1.3]$ yarn  applicationattempt  -list  application_1628495545961_0003

2021-08-10 09:30:48,979 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of application attempts :1
         ApplicationAttempt-Id	               State	                    AM-Container-Id	                       Tracking-URL
appattempt_1628495545961_0003_000001	            FINISHED	container_1628495545961_0003_01_000001	http://hadoop103:8088/proxy/application_1628495545961_0003/

(2)打印 ApplicationAttemp 状态:yarn applicationattempt -status

[yasin@hadoop102 hadoop-3.1.3]$ yarn  applicationattempt  -status appattempt_1628495545961_0003_000001

2021-08-10 09:39:13,663 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Application Attempt Report : 
	ApplicationAttempt-Id : appattempt_1628495545961_0003_000001
	State : FINISHED
	AMContainer : container_1628495545961_0003_01_000001
	Tracking-URL : http://hadoop103:8088/proxy/application_1628495545961_0003/
	RPC Port : 34529
	AM Host : hadoop104
	Diagnostics : 

4、Yarn Container 查看容器

(1)列出所有 Container:yarn container -list

[yasin@hadoop102 hadoop-3.1.3]$ yarn  container  -list appattempt_1628495545961_0003_000001

2021-08-10 09:45:00,034 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of containers :0
                  Container-Id	          Start Time	         Finish Time	               State	                Host	   Node Http Address	                            LOG-URL

(2)打印 Container 状态: yarn container -status

[yasin@hadoop102 hadoop-3.1.3]$ yarn  container  -status container_1628495545961_0003_01_000001

2021-08-10 09:56:12,780 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Container with id 'container_1628495545961_0003_01_000001' doesn't exist in RM or Timeline Server.

注:只有在任务跑的途中才能看到 container 的状态

5、Yarn node 查看节点状态

列出所有节点:yarn node -list -all

[yasin@hadoop102 hadoop-3.1.3]$ yarn node -list -all

2021-08-10 10:09:19,204 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total Nodes:3
         Node-Id	     Node-State	Node-Http-Address	Number-of-Running-Containers
 hadoop103:44775	        RUNNING	   hadoop103:8042	                           0
 hadoop104:46491	        RUNNING	   hadoop104:8042	                           0
 hadoop102:39080	        RUNNING	   hadoop102:8042	                           0

6、Yarn rmadmin 更新配置

加载队列配置:yarn rmadmin -refreshQueues

[yasin@hadoop102 hadoop-3.1.3]$ yarn rmadmin -refreshQueues

2021-08-10 10:09:55,898 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8033

7、Yarn queue 查看队列

打印队列信息:yarn queue -status

[yasin@hadoop102 hadoop-3.1.3]$ yarn queue -status default

2021-08-10 10:10:30,073 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Queue Information : 
Queue Name : default
	State : RUNNING
	Capacity : 100.0%
	Current Capacity : .0%
	Maximum Capacity : 100.0%
	Default Node Label expression : <DEFAULT_PARTITION>
	Accessible Node Labels : *
	Preemption : disabled
	Intra-queue Preemption : disabled
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南洲.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值