【大数据】YARN常用命令及Rest API

YARN

1.YARN常用命令

1.1 作业

命令说明
yarn application -list列出所有的application
yarn application -list -appStates [ALL、NEW、NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED]根据application状态过滤
yarn application -kill [applicationId]Kill掉application

查看所有任务

yarn application -list

查看指定任务状态的作业

# state 可选的有:ALL、NEW、NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED
yarn application -list -appStates <state>
# 示例
yarn application -list -appStates RUNNING,ACCEPTED

查看正在运行的任务信息

yarn applicationattempt -list <application_id>

结束作业

yarn application -kill <application_id>

1.2 日志

查询指定作业的日志

# 如果提示内存限制,可以在如下命令后,添加 --size -1
yarn logs -applicationId <application_id>

查询指定 Container 的日志

yarn logs -applicationId <application_id> -containerId <container_id>

1.3 Application Attempt

命令说明
yarn applicationattempt -list [ApplicationId]列出所有Application尝试的列表
yarn applicationattempt -status [ApplicationAttemptId]打印Application Attempt的状态

列出Application的所有尝试

yarn applicationattempt -list [ApplicationId]

打印Application Attempt的状态

yarn applicationattempt -status [ApplicationAttemptId]

1.4 容器

命令说明
yarn container -list [ApplicationAttemptId]列出所有的Container
yarn container -status [ContainerId]打印Container状态

列出所有的Container

yarn container -list [ApplicationAttemptId]

打印Container状态

yarn container -status [ContainerId]

1.5 其他

命令说明
yarn node -list -all查看节点状态
yarn rmadmin -refreshQueues加载队列配置
yarn queue -status [QueueName]打印队列信息

查看节点状态

yarn node -list -all

加载队列配置

# 需要在RM节点执行
yarn rmadmin -refreshQueues

查看队列状态

yarn queue -status [QueueName]

2.YARN Rest Api

YARN Rest Api文档地址:Apache Hadoop 3.3.6 – ResourceManager REST APIs.

2.1 集群

获取 RM 节点状态

# URL
http://rm-http-address:port/ws/v1/cluster/info
# Method
GET
# 示例
curl -X GET -u e3base:'Sit@Paas&123' -i "http://172.21.9.101:13006/ws/v1/cluster/info"
# 注:如果集群集成了kerbeors,需要增加--negotiate参数

获取集群Metrics

# URL
http://rm-http-address:port/ws/v1/cluster/metrics
# Method
GET
# 示例
curl -X GET -u e3base:'Sit@Paas&123' -i "http://172.21.9.101:13006/ws/v1/cluster/metrics"
# 注:如果集群集成了kerbeors,需要增加--negotiate参数

2.2 队列

获取集群队列

# URL
http://rm-http-address:port/ws/v1/cluster/scheduler
# Method
GET
# 示例
curl -X GET -u e3base:'Sit@Paas&123' -i "http://172.21.9.101:13006/ws/v1/cluster/scheduler"
# 注:如果集群集成了kerbeors,需要增加--negotiate参数

2.3 作业

获取集群作业

# URL
http://rm-http-address:port/ws/v1/cluster/apps
# Method
GET
# 示例
curl -X GET -u e3base:'Sit@Paas&123' -i "http://172.21.9.101:13006/ws/v1/cluster/apps"
# 注:如果集群集成了kerbeors,需要增加--negotiate参数

3.其他

3.1 相关资源

  1. YARN官方文档:Hadoop – Apache Hadoop 3.3.6

  2. 大数据之Hadoop集群中YARN常用命令:https://www.cnblogs.com/sw-code/p/16387038.html

  • 25
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值