Hadoop——Yarn命令

Yarn命令

Apache Hadoop YARN(Yet Another Resource Negotiator)是用于集群资源管理和作业调度的核心组件。以下是一些常用的 YARN 命令:

  1. 启动 YARN ResourceManager
    yarn resourcemanager
    

运行结果示例:

	ResourceManager running as process 1234. Stop it using yarn-daemon.sh.
  1. 启动 YARN NodeManager
    yarn nodemanager
    

运行结果示例:

	 NodeManager running as process 5678. Stop it using yarn-daemon.sh
  1. 查看集群状态
    yarn rmadmin -getServiceState rm1
    

运行结果示例:

 Standby
  1. 列出集群中的节点
    yarn node -list
    

运行结果示例:

Node-Id             Node-State Node-Http-Address   Number-of-Containers
node1.example.com   RUNNING    http://node1:8042    2
node2.example.com   RUNNING    http://node2:8042    0
  1. 列出集群中正在运行的应用程序
    yarn application -list
    

运行结果示例:

Total Applications:2
             Application-Id      Application-Name        Application-Type          User       Queue                   State             Final-State             Progress                        Tracking-URL
application_1617646333047_0001         WordCount               MAPREDUCE           john         default                  RUNNING                     UNDEFINED       50%             http://node1:8088/proxy/application_1617646333047_0001/
application_1617646333047_0002         PageRank                MAPREDUCE           alice        default                  FINISHED                     SUCCEEDED        100%            http://node1:8088/proxy/application_1617646333047_0002/
  1. 查看应用程序详情
    yarn application -status <application_id>
    

运行结果示例:

Application Report :
    Application-Id : application_1617646333047_0001
    Application-Name : WordCount
    State : RUNNING
    Final-State : UNDEFINED
    Tracking-URL : http://node1:8088/proxy/application_1617646333047_0001/
  1. 杀死应用程序

    yarn application -kill <application_id>
    

    运行结果示例:

    Killed application application_1617646333047_0001
    
  2. 查看队列信息

    yarn queue -status <queue_name>
    

运行结果示例:

Queue Name : root.users.john
Queue State : RUNNING
  1. 查看指定用户的应用程序
    yarn application -list -appStates <states> -user <username>
    

运行结果示例:

Total Applications:1
             Application-Id      Application-Name        Application-Type          User       Queue                   State             Final-State             Progress                        Tracking-URL
application_1617646333047_0001         WordCount               MAPREDUCE           john         default                  RUNNING                     UNDEFINED       50%             http://node1:8088/proxy/application_1617646333047_0001/
  1. 查看应用程序的日志
    yarn logs -applicationId <application_id>
    

运行结果示例:

	2024-04-18 10:15:33,059 INFO mapreduce.Job:  map 50% reduce 0%
  1. 查看应用程序的调度信息
    yarn app -showappqueues <application_id>
    
    运行结果示例:
 Queue Name : root.default
 Capacity : 100.0%
 Max Capacity : 100.0%
  1. 查看应用程序的容器信息
    yarn container -status <container_id>
    

运行结果示例:

 ContainerId: container_e10_1617646333047_0001_01_000001
 NodeHttpAddress: node1.example.com:8042
  1. 查看队列的配置信息
    yarn queue -status <queue_name>
    

运行结果示例:

 Queue Name : root.users.john
 Queue State : RUNNING
  1. 刷新节点资源
    yarn rmadmin -refreshNodes
    

运行结果示例:

	Refreshed Nodes in the cluster
  1. 刷新队列信息
    yarn rmadmin -refreshQueues
    

运行结果示例:

	Refreshed Queues in the cluster
  1. 暂停队列
    yarn rmadmin -refreshQueues -disableQueue <queue_name>
    

运行结果示例:

	Queue 'root.users.john' disabled.
  1. 恢复队列
    yarn rmadmin -refreshQueues -enableQueue <queue_name>
    

运行结果示例:

	Queue 'root.users.john' enabled.
  1. 查看 YARN ResourceManager 配置
    yarn rmadmin -getconf <config_property>
    

运行结果示例:

	yarn.nodemanager.resource.memory-mb=8192
  1. 更新 YARN ResourceManager 配置
    yarn rmadmin -refreshServiceAcl
    

运行结果示例:

	Refreshed service ACLs
  1. 重新加载 ResourceManager 配置
    yarn rmadmin -refreshServiceAcl
    

运行结果示例:

	Refreshed Nodes in the cluster
  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

喻师傅

谢谢您!我会继续努力创作!

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

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

打赏作者

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

抵扣说明:

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

余额充值