Overview
YARN commands are invoked through the bin/yarn script. Running the script without any arguments prints descriptions of all commands.
Usage: yarn [--config confdir] COMMAND [--loglevel loglevel] [GENERIC_OPTIONS] [COMMAND_OPTIONS]
YARN has an option parsing framework for parsing common options and running classes.
COMMAND_OPTIONS | Description |
--config confdir | Override the default configuration directory. Defaults to ${HADOOP_PREFIX}/conf |
--loglevel loglevel | Override log level. Valid log levels are FATAL, ERROR, WARN, INFO, DEBUG, and TRACE. Default is INFO. |
GENERIC_OPTIONS | A collection of common options supported by multiple commands. |
COMMAND COMMAND_OPTIONS | The various commands and their options are described in the following sections. commands have been divided into User Command and Administration Command. |
User Commands
Command useful for Hadoop cluster users.
application
Usage: yarn application [options]
COMMAND_OPTIONS | Description |
-appStates <States> | Use with -list to filter applications based on a comma-separated list of application states entered. Valid application state can be as follows: ALL, NEW, NEW_SAVING, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED |
-appTypes <Types> | Used with -list to filter applications based on an incoming comma-separated list of application types. |
-list | View the application list from RM. Supports the use of the -appTypes option to filter applications based on application type. Supports the use of the -appStates option to filter applications based on application state. |
-kill <ApplicationId> | kill application |
-status <ApplicationId> | Print application status. |
print application report / kill application
applicationattempt
Usage: yarn applicationattempt [options]
COMMAND_OPTIONS | Description |
-help | Help |
-list <ApplicationId> | List application attempts for the specified application. |
-status <Application Attempt Id> | Print the status information of the application attempt. |
print applicationattempt report
classpath
Usage: yarn classpath
prints the class path that requires hadoop jar and other libraries
container
Usage: yarn container [options]
COMMAND_OPTIONS | Description |
-help | Help |
-list <Application Attempt Id> | List the containers of the application attempt. |
-status <ContainerId> | Print the status of the container. |
print container report
jar
Usage: yarn jar <jar> [mainClass] args...
运行一个jar文件。用户可以将他们的YARN代码打包到一个jar文件,可以使用这个command执行它。
logs
Usage: yarn logs -applicationId <application ID> [options]
COMMAND_OPTIONS | Description |
-applicationId <application ID> | 指定application id。 |
-appOwner <AppOwner> | AppOwner (如果未指定则为当前用户) |
-containerId <ContainerId> | ContainerId (如果node address已经指定则该项必须指定) |
-help | Help |
-nodeAddress <NodeAddress> | NodeAddress 采用以下格式:nodename:port (如果container id指定了则该项必须指定) |
Dump the container logs
node
Usage: yarn node [options]
COMMAND_OPTIONS | Description |
-all | 与-list一起使用可列出所有node。 |
-list | 列出所有running的node。支持使用-states选项基于node state对node进行过滤,-all表示列出所有node。 |
-states <States> | 与-list一起使用可以基于输入的逗号分隔的node state列表进行node的过滤。 |
-status <NodeId> | 打印node的status report |
打印node report
queue
Usage: yarn queue [options]
COMMAND_OPTIONS | Description |
-help | Help |
-status <QueueName> | 打印队列状态信息。 |
打印队列信息
version
Usage: yarn version
打印hadoop版本.
管理Commands
管理hadoop集群的相关命令。
daemonlog
Usage:
yarn daemonlog -getlevel <host:httpport> <classname> yarn daemonlog -setlevel <host:httpport> <classname> <level>
COMMAND_OPTIONS | Description |
-getlevel <host:httpport> <classname> | 打印出运行在<host:httpport>deamon中的classname的log日志级别。这个命令内部连接到http://<host:httpport>/logLevel?log=<classname>。 |
-setlevel <host:httpport> <classname> <level> | 设置运行在<host:httpport>的deamon中的classname的日志级别。这个命令内部是连接到http://<host:httpport>/logLevel?log=<classname>&level=<level><level>http://<host:httpport>/logLevel?log=<classname>&level=<level> http://<host:httpport>/logLevel?log=<classname>&level=<level> |
Get/Set deamon中class name的日志级别。
示例: $ bin/yarn daemonlog -setlevel 127.0.0.1:8088 org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl DEBUG
nodemanager
Usage: yarn nodemanager
启动NodeManager
proxyserver
Usage: yarn proxyserver
启动web proxy server
resourcemanager
Usage: yarn resourcemanager [-format-state-store]
COMMAND_OPTIONS | Description |
-format-state-store | 格式化RMStateStore。这将会清除RMStateStroe,这在旧数据不在需要时会用到。这只应该是在ResourceManager不运行的时候执行。 |
启动ResourceManager
rmadmin
Usage:
yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshUserToGroupsMapping] [-refreshSuperUserGroupsConfiguration] [-refreshAdminAcls] [-refreshServiceAcl] [-getGroups [username]] [-transitionToActive [--forceactive] [--forcemanual] <serviceId>] [-transitionToStandby [--forcemanual] <serviceId>] [-failover [--forcefence] [--forceactive] <serviceId1> <serviceId2>] [-getServiceState <serviceId>] [-checkHealth <serviceId>] [-help [cmd]]
COMMAND_OPTIONS | Description |
-refreshQueues | 重新加载队列的acls,state和scheduler特定属性。ResourceManager会重新加载mapred-queues配置文件。 |
-refreshNodes | 在ResourceManager中刷新host信息。 |
-refreshUserToGroupsMappings | 刷新用户-组映射。 |
-refreshSuperUserGroupsConfiguration | 刷新超级用户代理组映射。 |
-refreshAdminAcls | 刷新ResourceManager的administration acls。 |
-refreshServiceAcl | 重新加载service-level授权策略文件,ResourceManager会重新加载授权策略文件。 |
-getGroups [username] | 获取指定用户属于的组。 |
-transitionToActive [–forceactive] [–forcemanual] <serviceId> | 将service转换为Active state. 如果使用了 –forceactive选项,那么目标直接active,无需检查当前是否已经没有active node。如果自动灾备启用的话,不能使用该命令。虽然你可以通过forcemanual 选项强行override,但是你需要非常小心。 |
-transitionToStandby [–forcemanual] <serviceId> | 将service转换为standby状态。这个命令不能在自动灾备启用的情况下使用。虽然你可以通过forcemanual 选项强行override,但是你需要非常小 |
-failover [–forceactive] <serviceId1> <serviceId2> | 初始化故障恢复,从serviceId1 切换到serviceId2。如果使用-forceactive 选项,那么会转移到目标service,哪怕它还没有ready。 |
-getServiceState <serviceId> | 获取service的state。 |
-checkHealth <serviceId> | 请求对service执行一次健康度检查。如果检查失败,RMAdmin工具的退出码为非零数字。 |
-help [cmd] | 显示指定command的帮助信息,如果未指定则显示全部命令的帮助信息。 |
运行ResourceManager 管理客户端。
scmadmin
Usage: yarn scmadmin [options]
COMMAND_OPTIONS | Description |
-help | Help |
-runCleanerTask | 执行清除task |
Runs Shared Cache Manager admin client
sharedcachemanager
Usage: yarn sharedcachemanager
Start the Shared Cache Manager
timelineserver
Usage: yarn timelineserver
Start the TimeLineServer