Yarn 常用命令

  1. yarn命令

    用法:

    yarn [--config confdir] COMMAND
    
    参数描述
    resourcemanager -format-state-store格式化RMStateStore,只有当历史作业不再需要时,才需要格式化
    resourcemanager启动 ResourceManager。用 -format-state-store for 删除 RMStateStore; 使用 -remove-application-from-state-store 从RMStateStore中删除应用程序
    nodemanager在每个节点启动 NodeManager
    timelineserver启动 timeline server
    rmadmin管理工具
    version版本信息
    jar 运行 jar 文件
    application查看应用程序状态,或终止应用程序
    applicationattempt打印应用程序尝试报告
    container打印 Container 尝试报告
    node打印节点尝试报告
    queue打印对列信息,只有一个参数
    logs主要用于收集作业日志,注意要等程序结束才能查看日志
    classpath打印 Hadoop 相关依赖和其他依赖库
    daemonlog针对指定的守护进程获取/设置日志优先级
    top启动集群使用工具
    CLASSNAME启动 CLASSNAME 类

    示例:

    [root@cdh01:~]# yarn version
    Hadoop 2.6.0-cdh5.12.1
    Subversion http://github.com/cloudera/hadoop -r 520d8b072e666e9f21d645ca6a5219fc37535a52 
    Compiled by jenkins on 2017-08-24T16:43Z
    Compiled with protoc 2.5.0
    From source with checksum de51bf9693ab9426379a1cd28142cea0
    This command was run using /opt/cloudera/parcels/CDH-5.12.1-1.cdh5.12.1.p0.3/jars/hadoop-common-2.6.0-cdh5.12.1.jar
    
  2. yarn rmadmin 命令

    用法:

    Usage: yarn rmadmin COMMAND
    
    参数描述
    -refreshQueues重载队列的ACL、状态和调度器特定的属性,ResourceManager将重新加载mapred-queues配置文件
    -refreshNodes [-g [timeout in seconds] -clientserver]
    -refreshSuperUserGroupsConfiguration刷新用户组的配置
    -refreshUserToGroupsMappings刷新用户到组的映射
    -refreshAdminAcls刷新 ResourceManager 的 ACL 管理
    -refreshServiceAclResourceManager 重载服务级别的授权文件
    -getGroups [username]获取指定用户所属的组
    -help [cmd]显示指定命令的帮助,没有指定,则显示全部指令帮助
    -addToClusterNodeLabels [label1,label2,label3] (label splitted by “,”)添加标签
    -removeFromClusterNodeLabels [label1,label2,label3] (label splitted by “,”)移除标签
    -replaceLabelsOnNode [label1,label2,label3] (label splitted by “,”)替换标签
    directlyAccessNodeLabelStore
    transitionToActive [–forceactive]
    transitionToStandby
    failover [–forcefence] [–forceactive]
    getServiceState
    checkHealth

    示例:

    [root@cdh01:~]# yarn rmadmin -getGroups hdfs
    hdfs : hdfs hadoop supergroup
    
  3. yarn application 命令

    用法:

    Usage: yarn application COMMAND
    
    参数描述
    -appStates 与 -list 配合使用,基于应用程序的状态来过滤,多个状态用逗号分隔状态。有效的状态: ALL,NEW,NEW_SAVING,SUBMITTED,ACCEPTED,RUNNING,FINISHED,FAILED,KILLED
    -appTypes 与 -list 配合使用,基于应用程序的类型来过滤,多个应用程序用逗号分隔
    -help帮助列表
    -kill 杀死指定的应用程序
    -list从 ResourceManager 获取应用程序列表. 使用 -appTypes 基于应用程序的类型来过滤 使用 -appStates 基于应用程序的状态来过滤
    -movetoqueue 将应用程序移动到不同的队列
    -queue 与 movetoqueue配合使用,移到指定队列
    -status 获取应用程序的状态

    示例:

    [root@cdh01:~]# yarn application -status application_1557221110563_0246
    ...
    Application Report : 
    	Application-Id : application_1557221110563_0246
    	Application-Name : INSERT OVERWRITE TABLE hdsc...hdsc.base_user(Stage-1)
    	Application-Type : MAPREDUCE
    	User : admin
    	Queue : default
    	Start-Time : 1557366149859
    	Finish-Time : 1557366154321
    	Progress : 100%
    	State : KILLED
    	Final-State : KILLED
    	Tracking-URL : null
    	RPC Port : -1
    	AM Host : N/A
    	Aggregate Resource Allocation : 3111 MB-seconds, 2 vcore-seconds
    	Log Aggregation Status : NOT_START
    	Diagnostics : Application killed by user.
    
  4. yarn applicationattempt 命令

    用法:

    Usage: yarn applicationattempt COMMAND
    
    参数描述
    -help帮助列表
    -list 获取应用程序尝试的列表
    -status 获取应用程序尝试的状态

    示例:

    [root@cdh01:~]# yarn applicationattempt -list application_1557221110563_0246
    ...
    Total number of application attempts :1
    		 ApplicationAttempt-Id	               State	                    AM-Container-Id	                       Tracking-URL
    appattempt_1557221110563_0246_000001	              KILLED	container_e52_1557221110563_0246_01_000002	http://slave1:8088/proxy/application_1557221110563_0246/
    
    [root@cdh01:~]# yarn applicationattempt -status appattempt_1557221110563_0246_000001
    Application Attempt Report : 
    ApplicationAttempt-Id : appattempt_1557221110563_0246_000001
    State : KILLED
    AMContainer : container_e52_1557221110563_0246_01_000002
    Tracking-URL : http://slave1:8088/proxy/application_1557221110563_0246/
    RPC Port : -1
    AM Host : N/A
    Diagnostics : Attempt recovered after RM restart
    
  5. yarn container 命令

    用法:

    Usage: yarn container COMMAND
    
    参数描述
    -help帮助列表
    -list 获取 Container 列表
    -status 获取 Container 的状态

    示例:

    [root@cdh01:~]# yarn container -list appattempt_1557221110563_0369_000001
    ...
    Total number of containers :0
    				  Container-Id	          Start Time	         Finish Time	               State	                Host	                            LOG-URL
    
  6. yarn node 命令

    用法:

    yarn node COMMAND
    
    参数描述
    -all与 -list 打印所有节点的报告
    -list获取所有 RUNNING 状态的节点。 支持 -states 选项过滤指定的状态。节点状态包括 NEW,RUNNING,UNHEALTH,DECOMMISSIONED,LOST 和 REBOOTED
    -states 与 -list 配合使用,用逗号分隔节点状态,只显示这些状态的节点信息
    -status 获取指点节点的状态

    示例:

    [root@cdh01:~]# yarn node -all -list
    ...
    Total Nodes:5
       Node-Id	     Node-State	Node-Http-Address	Number-of-Running-Containers
    cdh01:8041	        RUNNING	cdh01:8042	                  0
    cdh02:8041	        RUNNING	cdh02:8042	                  0
    cdh03:8041	        RUNNING	cdh03:8042	                  0
    cdh04:8041	        RUNNING	cdh04:8042	                  0
    cdh05:8041	        RUNNING	cdh05:8042	                  0
    
    [root@cdh01:~]# yarn node -status cdh01:8041
    Node Report : 
    Node-Id : cdh01:8041
    Rack : /default
    Node-State : RUNNING
    Node-Http-Address : cdh01:8042
    Last-Health-Update : Thu 30/May/19 08:14:31:270CST
    Health-Report : 
    Containers : 0
    Memory-Used : 0MB
    Memory-Capacity : 12288MB
    CPU-Used : 0 vcores
    CPU-Capacity : 4 vcores
    Node-Labels : 
    
  7. yarn queue 命令

    用法:

    yarn queue COMMAND
    
    参数描述
    -help帮助列表
    -status 获取队列的状态

    示例:

    [root@cdh01:~]# yarn queue -status default
    ...
    Queue Information : 
    Queue Name : root.default
    	State : RUNNING
    	Capacity : .0%
    	Current Capacity : .0%
    	Maximum Capacity : -100.0%
    	Default Node Label expression : 
    	Accessible Node Labels : 
    
  8. yarn logs 命令

    用法:

    yarn logs -applicationId <application ID> [OPTIONS]
    
    参数描述
    -appOwner 指定应用程序的所有者
    -containerId 指定运行任务的 Container ID
    -nodeAddress 指定运行任务的节点,格式为 host:name
  9. yarn daemonlog 命令

    用法:

    yarn daemonlog -getlevel <host:port> <classname> [-protocol (http|https)]
    或
    yarn daemonlog -setlevel <host:port> <classname> <level> [-protocol (http|https)]
    
    参数描述
    -getlevel host:port 针对指定的守护进程获取日志优先级
    -setlevel host:port [-protocol (httphttps)

    示例:

    [root@cdh01:~]# yarn daemonlog -getlevel cdh01:50075 org.apache.hadoop.hdfs.server.datanode.DataNode
    root@bigdata-sit-54:~# yarn daemonlog -getlevel bigdata-sit-54:50075 org.apache.hadoop.hdfs.server.datanode.DataNode
    Connecting to http://cdh01:50075/logLevel?log=org.apache.hadoop.hdfs.server.datanode.DataNode
    Submitted Log Name: org.apache.hadoop.hdfs.server.datanode.DataNode
    Log Class: org.apache.commons.logging.impl.Log4JLogger
    Effective Level: INFO
    [root@cdh01:~]# yarn daemonlog -getlevel cdh01:8088 org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl
    Connecting to http://cdh01:8088/logLevel?log=org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl
    Submitted Log Name: org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl
    Log Class: org.apache.commons.logging.impl.Log4JLogger
    Effective Level: INFO
    [root@cdh01:~]# yarn daemonlog -getlevel cdh01:19888 org.apache.hadoop.mapreduce.v2.hs.JobHistory
    Connecting to http://cdh01:19888/logLevel?log=org.apache.hadoop.mapreduce.v2.hs.JobHistory
    Submitted Log Name: org.apache.hadoop.mapreduce.v2.hs.JobHistory
    Log Class: org.apache.commons.logging.impl.Log4JLogger
    Effective Level: INFO
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值