一、查看任务
1、查看所有任务
bash
yarn application -list
![](https://img-blog.csdnimg.cn/direct/76e52922272144679c3bab6f9ea86ddf.png)
2、根据状态查看任务
语法
bash
yarn application -list -appStates (所有状态:ALL、NEW、NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED)
例如
bash
yarn application -list -appStates FINISHED
![](https://img-blog.csdnimg.cn/direct/d159aa06819c41908c3a7a6f03af4073.png)
3、Kill掉Application
根据appid kill
任务
bash
yarn application -kill application_1719625561008_0003
![](https://img-blog.csdnimg.cn/direct/13ff1d8b71364d5c871c632feac24c4b.png)
二、查看日志
1、查询Application日志
语法
bash
yarn logs -applicationId <ApplicationId>
案例
bash
yarn logs -applicationId application_1719625561008_0003
2、查询Container日志
语法
bash
yarn logs -applicationId <ApplicationId> -containerId <ContainerId>
案例
bash
yarn logs -applicationId application_1719625561008_0003 -containerId container_1719625561008_0003_01_000001
![](https://img-blog.csdnimg.cn/direct/8f2dcdfdb88d40c6a2140ad7f6066cd4.png)
三、查看尝试运行的任务
1、列出所有Application尝试的列表
语法
bash
yarn applicationattempt -list <ApplicationId>
案例
bash
yarn applicationattempt -list application_1719625561008_0003
这里我们可以查看到ContainerId
和ApplicationAttemptId
2、打印ApplicationAttemp状态
语法
bash
yarn applicationattempt -status <ApplicationAttemptId>
案例
bash
yarn applicationattempt -status appattempt_1719625561008_0003_000001
![](https://img-blog.csdnimg.cn/direct/3c5c6582aef7474b9a7987764c139f98.png)
四、查看容器
1、列出所有Container
语法
bash
yarn container -list <ApplicationAttemptId>
案例1(运行完的任务)
容器只有在任务运行的时候,才能查看到
运行结束的任务,是查看不到对应的容器的
bash
yarn container -list appattempt_1719625561008_0003_000001
![](https://img-blog.csdnimg.cn/direct/4050103f2a84416783ce705cd8a3cb84.png)
案例2(运行中的任务)
bash
yarn container -list appattempt_1719625561008_0004_000001
![](https://img-blog.csdnimg.cn/direct/22ed9d75578543138cfd754b2364785e.png)
2、查看Container状态
语法
bash
yarn container -status <ContainerId>
案例
bash
yarn container -status container_1719625561008_0003_01_000001
![](https://img-blog.csdnimg.cn/direct/e5b310e0684041a0927d75391c892ee3.png)
五、查看节点状态
1、列出所有节点
案例
bash
yarn node -list -all
![](https://img-blog.csdnimg.cn/direct/b6a4f03a26f64948b3b1e029e58e6521.png)
六、重新加载Yarn配置
1、更新Yarn队列相关配置
修改配置后,直接执行该命令,就可以加载最新配置,无需重启Yarn服务
对应配置文件:capacity-scheduler.xml
bash
yarn rmadmin -refreshQueues
![](https://img-blog.csdnimg.cn/direct/7804748efa5f4c95b81a0b71f777dba7.png)
七、查看队列
1、查看队列状态
语法
bash
yarn queue -status <QueueName>
案例
bash
yarn queue -status default
![](https://img-blog.csdnimg.cn/direct/946162a355794b9e8b32e93c7efd2e48.png)
页面端查看