【YARN运维】Yarn常见任务shell运维命令:集群状态、查看任务、任务日志

一. 查看Yarn集群状态

1. 集群所有节点状态

yarn node -list -all

Total Nodes:4
         Node-Id             Node-State Node-Http-Address       Number-of-Running-Containers
    hadoop6:8842                RUNNING      hadoop6:8042                                  1
    hadoop3:8842                RUNNING      hadoop3:8042                                  0
    hadoop5:8842                RUNNING      hadoop5:8042                                  0
    hadoop4:8842                RUNNING      hadoop4:8042                                  0

 

2. 某个队列的情况

yarn queue -status default

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Queue Information :
Queue Name : root.default
        State : RUNNING
        Capacity : .0%
        Current Capacity : .0%
        Maximum Capacity : -100.0%
        Default Node Label expression : DEFAULT_LABEL
        Accessible Node Labels : DEFAULT_LABEL

 

curl http://yarn-node:8088/ws/v1/cluster/scheduler

 

二. 查看任务

1. 查看所有任务

yarn application -list

Total number of applications (application-types: [] and states: [SUBMITTED, ACCEPTED, RUNNING]):1
                Application-Id      Application-Name        Application-Type          User           Queue                   State             Final-State             Progress                        Tracking-URL
application_1581674307855_264715                     jdittoa            Apache Flink          work       root.work                 RUNNING               UNDEFINED                 100%                 http://hadoop6:44358

 

2. 查看处于某个状态的任务

状态有:ALL、NEW、NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED。

yarn application -list -appStates running

Total number of applications (application-types: [] and states: [RUNNING]):1
                Application-Id      Application-Name        Application-Type          User           Queue                   State             Final-State             Progress                        Tracking-URL
application_1581674307855_264715                     jdittoa            Apache Flink          work       root.work                 RUNNING               UNDEFINED                 100%                 http://hadoop6:44358

 

3. 查看任务尝试情况

如下任务尝试了一次

yarn applicationattempt -list application_1581674307855_264715

Total number of application attempts :1
         ApplicationAttempt-Id                 State                        AM-Container-Id                            Tracking-URL
appattempt_1581674307855_264715_000001               RUNNING    container_e03_1581674307855_264715_01_000001    http://hadoop1:8888/proxy/application_1581674307855_264715/

 

查看尝试任务的状态,id由上获取

yarn applicationattempt -status appattempt_1581674307855_264715_000001

Application Attempt Report :
        ApplicationAttempt-Id : appattempt_1581674307855_264715_000001
        State : RUNNING
        AMContainer : container_e03_1581674307855_264715_01_000001
        Tracking-URL : http://hadoop1:8888/proxy/application_1581674307855_264715/
        RPC Port : 44358
        AM Host : hadoop6
        Diagnostics : Attempt recovered after RM restart

查看(正在运行任务的)container情况

yarn container -status container_e03_1581674307855_264715_01_000001

Container Report :
        Container-Id : container_e03_1581674307855_264715_01_000001
        Start-Time : 1611554602648
        Finish-Time : 0
        State : RUNNING
        LOG-URL : http://hadoop6:8042/node/containerlogs/container_e03_1581674307855_264715_01_000001/work
        Host : hadoop6:8842
        NodeHttpAddress : http://hadoop6:8042
        Diagnostics : null

 

4. 杀掉任务

 yarn application -kill app_id
 

 

三. 查看日志

1. 任务日志


yarn logs -applicationId application_1581674307855_264715

 

2. 查看某个container的日志

 yarn logs -applicationId application_1581674307855_264715 \
 -containerId container_e03_1581674307855_264715_01_000001 \
 -nodeAddress hadoop6

 

  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

roman_日积跬步-终至千里

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

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

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

打赏作者

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

抵扣说明:

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

余额充值