99网
您的当前位置:首页Hadoop实例学习(十五)YARNshell操作

Hadoop实例学习(十五)YARNshell操作

来源:99网

YARN常用命令

执行一个jar进行测试

[root@spark01 mapreduce]# hadoop jar hadoop-mapreduce-examples-3.2.1.jar pi 4 100

yarn application 查看任务列表

[root@spark01 bin]# yarn application -list

yarn application 查看任务状态

yarn application -list -appStates ALL/NEW/NEW_SAVING/SUBMITTED/ACCEPTED/RUNNING/FINISHED/FAILED/KILLED

yarn application 强杀任务

语法 : yarn application -kill applicationId
[root@spark01 bin]# yarn application -kill application_1625042652585_0003

yarn logs 查看日志

查询 Application 日志

[root@spark01 bin]# yarn logs -applicationId application_1625042652585_0003

查询 Container 日志

语法 : yarn logs -applicationId application的id -containerId 容器的id
[root@spark01 bin]# yarn logs -applicationId application_1625042652585_0003 -containerId container_e114_1625042652585_0003_02_000001

yarn applicationattempt 查看尝试运行的任务

列出所有 Application 尝试的列表

语法 : yarn applicationattempt -list <ApplicationId>
[root@spark01 bin]# yarn applicationattempt -list application_1625042652585_0003

打印 ApplicationAttemp 状态

语法 : yarn applicationattempt -status <ApplicationAttemptId>
[root@spark01 bin]# yarn applicationattempt -status appattempt_1625042652585_0003_000001

yarn container 查看容器

列出所有 Container

语法 : yarn container -list <ApplicationAttemptId>
[root@spark01 bin]# yarn container -list appattempt_1625042652585_0003_000001

打印 Container 状态

任务没启动是看不见状态的

语法 : yarn container -status <ContainerId>
[root@spark01 bin]# yarn container -status container_e114_1625042652585_0003_01_000001

yarn node 查看节点状态

[root@spark01 bin]# yarn node -list -all

yarn rmadmin 更新配置

每当更改yarn配置信息时可以使用以下语句进行更新

[root@spark01 bin]# yarn rmadmin -refreshQueues

yarn queue 查看队列

语法 : yarn queue -status <QueueName>
[root@spark01 bin]# yarn queue -status default

因篇幅问题不能全部显示,请点此查看更多更全内容