<p>YARN has an option parsing framework that employs parsing generic options as well as running classes.</p>
<tableborder="0"class="bodyTable">
<thead>
<trclass="a">
<thalign="left"> COMMAND_OPTIONS </th>
<thalign="left"> Description </th></tr>
</thead><tbody>
<trclass="b">
<tdalign="left"> SHELL_OPTIONS </td>
<tdalign="left"> The common set of shell options. These are documented on the <ahref="../../hadoop-project-dist/hadoop-common/CommandsManual.html#Shell_Options">Commands Manual</a> page. </td></tr>
<trclass="a">
<tdalign="left"> GENERIC_OPTIONS </td>
<tdalign="left"> The common set of options supported by multiple commands. See the Hadoop <ahref="../../hadoop-project-dist/hadoop-common/CommandsManual.html#Generic_Options">Commands Manual</a> for more information. </td></tr>
<trclass="b">
<tdalign="left"> COMMAND_OPTIONS </td>
<tdalign="left"> Various commands with their options are described in the following sections. The commands have been grouped into <ahref="#User_Commands">User Commands</a> and <ahref="#Administration_Commands">Administration Commands</a>. </td></tr>
</tbody>
</table></section><section>
<h2><aname="User_Commands"></a>User Commands</h2>
<p>Commands useful for users of a Hadoop cluster.</p><section>
<h3><aname="application_or_app"></a><code>application</code> or <code>app</code></h3>
<tdalign="left"> Specify Application Id to be operated </td></tr>
<trclass="a">
<tdalign="left"> -appStates <States></td>
<tdalign="left"> Works with -list to filter applications based on input comma-separated list of application states. The valid application state can be one of the following:  ALL, NEW, NEW_SAVING, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED </td></tr>
<trclass="b">
<tdalign="left"> -appTags <Tags></td>
<tdalign="left"> Works with -list to filter applications based on input comma-separated list of application tags. </td></tr>
<trclass="a">
<tdalign="left"> -appTypes <Types></td>
<tdalign="left"> Works with -list to filter applications based on input comma-separated list of application types. </td></tr>
<tdalign="left"> Moves application to a new queue. ApplicationId can be passed using ‘appId’ option. ‘movetoqueue’ command is deprecated, this new command ‘changeQueue’ performs same functionality. </td></tr>
<tdalign="left"> Works with -flex option to change the number of components/containers running for an application / long-running service. Supports absolute or relative changes, such as +1, 2, or -3. </td></tr>
<tdalign="left"> Works with -upgrade option to trigger the upgrade of specified components of the application. Multiple components should be separated by commas. </td></tr>
<tdalign="left"> Decommissions component instances for an application / long-running service. Requires -instances option. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<tdalign="left"> Destroys a saved application specification and removes all application data permanently. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<trclass="a">
<tdalign="left"> -enableFastLaunch </td>
<tdalign="left"> Uploads AM dependencies to HDFS to make future launches faster. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<trclass="b">
<tdalign="left"> -flex <Application Name or ID></td>
<tdalign="left"> Changes number of running containers for a component of an application / long-running service. Requires -component option. If name is provided, appType must be provided unless it is the default yarn-service. If ID is provided, the appType will be looked up. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<trclass="a">
<tdalign="left"> -help </td>
<tdalign="left"> Displays help for all commands. </td></tr>
<tdalign="left"> Works with -upgrade option to trigger the upgrade of specified component instances of the application. Also works with -decommission option to decommission specified component instances. Multiple instances should be separated by commas. </td></tr>
<tdalign="left"> Launches application from specification file (saves specification and starts application). Options -updateLifetime and -changeQueue can be specified to alter the values provided in the file. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<trclass="a">
<tdalign="left"> -list </td>
<tdalign="left"> List applications. Supports optional use of -appTypes to filter applications based on application type, -appStates to filter applications based on application state and -appTags to filter applications based on application tag. </td></tr>
<tdalign="left"> Saves specification file for an application. Options -updateLifetime and -changeQueue can be specified to alter the values provided in the file. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<tdalign="left"> Starts a previously saved application. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<trclass="b">
<tdalign="left"> -status <ApplicationId or ApplicationName></td>
<tdalign="left"> Prints the status of the application. If app ID is provided, it prints the generic YARN application status. If name is provided, it prints the application specific status based on app’s own implementation, and -appTypes option must be specified unless it is the default <code>yarn-service</code> type. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality.</td></tr>
<trclass="a">
<tdalign="left"> -stop <Application Name or ID></td>
<tdalign="left"> Stops application gracefully (may be started again later). If name is provided, appType must be provided unless it is the default yarn-service. If ID is provided, the appType will be looked up. Supports -appTypes option to specify which client implementation to use. Please ensure the framework corresponding to appType has provided the appropriate client implementation to handle this specific functionality. </td></tr>
<tdalign="left"> Update timeout of an application from NOW. ApplicationId can be passed using ‘appId’ option. Timeout value is in seconds. </td></tr>
<p>Prints the class path needed to get the Hadoop jar and the required libraries. If called without arguments, then prints the classpath set up by the command scripts, which is likely to contain wildcards in the classpath entries. Additional options print the classpath after wildcard expansion or write the classpath into the manifest of a jar file. The latter is useful in environments where wildcards cannot be used and the expanded classpath exceeds the maximum supported command line length.</p></section><section>
<tdalign="left"> Download logs to specified local folder </td></tr>
<trclass="a">
<tdalign="left"> -show_application_log_info </td>
<tdalign="left"> List all container IDs (combine this with –nodeAddress to get containerIds for all the containers on the specific NodeManager) </td></tr>
<trclass="b">
<tdalign="left"> -show_container_log_info </td>
<tdalign="left"> Show the container log metadata </td></tr>
<trclass="a">
<tdalign="left"> -size <size></td>
<tdalign="left"> Prints the log file’s first ‘n’ bytes or the last ‘n’ bytes (use negative values as bytes to read from the end) </td></tr>
<p>Get/Set the log level for a Log identified by a qualified class name in the daemon dynamically. See the Hadoop <ahref="../../hadoop-project-dist/hadoop-common/CommandsManual.html#daemonlog">Commands Manual</a> for more information.</p></section><section>
<tdalign="left"> Formats the RMStateStore. This will clear the RMStateStore and is useful if past applications are no longer needed. This should be run only when the ResourceManager is not running. </td></tr>
<tdalign="left"> Remove the application from RMStateStore. This should be run only when the ResourceManager is not running. </td></tr>
<trclass="b">
<tdalign="left"> -format-conf-store </td>
<tdalign="left"> Formats the YarnConfigurationStore. This will clear the persisted scheduler configuration under YarnConfigurationStore. This should be run only when the ResourceManager is not running. </td></tr>
<tdalign="left"> WARNING: This feature is experimental and not intended for production use! Development is still in progress so the converter should not be considered complete! <br/> Converts the specified Fair Scheduler configuration to Capacity Scheduler configuration. Requires two mandatory input files. First, the yarn-site.xml with the following format: [-y|yarnsiteconfig [<Path to the yarn-site.xml file>]. Secondly, the fair-scheduler.xml with the following format: [-f|fsconfig [<Path to the fair-scheduler.xml file>]. This config is not mandatory if there is a reference in yarn-site.xml to the fair-scheduler.xml with the property ‘yarn.scheduler.fair.allocation.file’. If both are defined, the -f option has precedence. The output directory of the config files should be specified as well, with: [-o|output-directory\ <directory>]. An optional rules config file could be also specified with the following format: [-r|rulesconfig <Path to the conversion rules file>]. The rule config file’s format is a property file. There’s an additional [-p|print] parameter, which is optional. If defined, the configuration will be emitted to the console instead. In its normal operation, the output files (yarn-site.xml and capacity-scheduler.xml) of this command is generated to the specified output directory. The cluster resource parameter ([-c|cluster-resource] <resource>]) needs to be specified if any queue has a maxResources setting with value as percentage. The format of the resource string is the same as in fair-scheduler.xml.) ] </td></tr>
</tbody>
</table>
<p>Start the ResourceManager</p></section><section>
<tdalign="left"> Reload the queues’ acls, states and scheduler specific properties. ResourceManager will reload the mapred-queues configuration file. </td></tr>
<trclass="a">
<tdalign="left"> -refreshNodes [-g|graceful [timeout in seconds] -client|server] </td>
<tdalign="left"> Refresh the hosts information at the ResourceManager. Here [-g|graceful [timeout in seconds] -client|server] is optional, if we specify the timeout then ResourceManager will wait for timeout before marking the NodeManager as decommissioned. The -client|server indicates if the timeout tracking should be handled by the client or the ResourceManager. The client-side tracking is blocking, while the server-side tracking is not. Omitting the timeout, or a timeout of -1, indicates an infinite timeout. Known Issue: the server-side tracking will immediately decommission if an RM HA failover occurs. </td></tr>
<trclass="b">
<tdalign="left"> -refreshNodesResources </td>
<tdalign="left"> Refresh resources of NodeManagers at the ResourceManager. </td></tr>
<tdalign="left"> Replace labels on nodes (please note that we do not support specifying multiple labels on a single host for now.) -failOnUnknownNodes is optional, when we set this option, it will fail if specified nodes are unknown.</td></tr>
<tdalign="left"> This is DEPRECATED, will be removed in future releases. Directly access node label store, with this option, all node label related operations will not connect RM. Instead, they will access/modify stored node labels directly. By default, it is false (access via RM). AND PLEASE NOTE: if you configured yarn.node-labels.fs-store.root-dir to a local directory (instead of NFS or HDFS), this option will only work when the command run on the machine where RM is running. </td></tr>
<trclass="b">
<tdalign="left"> -refreshClusterMaxPriority </td>
<tdalign="left"> Refresh cluster max priority </td></tr>
<tdalign="left"> Update resource types on specific node. Resource Types is comma-delimited key value pairs of any resources available at Resource Manager. For example, memory-mb=1024Mi,vcores=1,resource1=2G,resource2=4m</td></tr>
<tdalign="left"> Transitions the service into Active state. Try to make the target active without checking that there is no active node if the –forceactive option is used. This command can not be used if automatic failover is enabled. Though you can override this by –forcemanual option, you need caution. This command can not be used if automatic failover is enabled.</td></tr>
<tdalign="left"> Transitions the service into Standby state. This command can not be used if automatic failover is enabled. Though you can override this by –forcemanual option, you need caution. </td></tr>
<tdalign="left"> Semicolon separated values of queues to add and their queue configurations. This example adds queue “queuePath1” (a full path name), which has queue configurations key1=val1 and key2=val2. It also adds queue “queuePath2”, which has queue configuration key3=val3. </td></tr>
<tdalign="left"> Semicolon separated queues to remove. This example removes queuePath1 and queuePath2 queues (full path names). <b>Note:</b> Queues must be put into <code>STOPPED</code> state before they are deleted. </td></tr>
<tdalign="left"> Semicolon separated values of queues whose configurations should be updated. This example sets key1=val1 and key2=val2 for queue configuration of queuePath1 (full path name), and sets key3=val3 for queue configuration of queuePath2. </td></tr>
<tdalign="left"> Update scheduler global configurations. This example sets key1=val1 and key2=val2 for scheduler’s global configuration. </td></tr>
</tbody>
</table>
<p>Updates scheduler configuration. Note, this feature is in alpha phase and is subject to change.</p></section><section>
<tdalign="left"> This file allows for advanced users to override some shell functionality. </td></tr>
<trclass="a">
<tdalign="left"> ~/.hadooprc </td>
<tdalign="left"> This stores the personal environment for an individual user. It is processed after the <code>hadoop-env.sh</code>, <code>hadoop-user-functions.sh</code>, and <code>yarn-env.sh</code> files and can contain the same settings. </td></tr>