Working with YARN distributed CLI

YARN CLI provides three types of commands. The first type is for users who wish to use YARN infrastructure for developing applications. The second type are administrative commands, which provide monitoring and administrative capabilities of all components of YARN including resource manager, application master, and timeline server. The third type are daemon commands, which are used for maintenance purposes covering stopping, starting, and restarting of daemons. Now, let’s look at user commands for YARN:

CommandParametersDescriptionImportant Parameters
applicationyarn application <command> <parameters>All actions pertaining to applications such as print and kill.- appID <applicationID>
- kill <applicationID>
- list
- status <applicationID>
applicationattemptyarn applicationattempt <parameter>Prints an application attempt(s) report. 
classpathyarn classpath --jar <path>Prints the classpath needed for the given JARor prints the current classpath set when passed without a parameter. 
containeryarn container <parameters>Prints a container report.-status <containerID>
-list  <applicationattemptID>
jaryarn jar <jar file> <mainClassName>Runs the given JAR file in YARN. The main class name is needed. 
logsyarn logs <command> <parameter>Dumps the log for a given application, container, or owner.-applicationId <applicationID>
- containerId <containerID>
nodeyarn node <command> <parameter>Prints node-related reports.-all prints it for all nodes
- list - lists all nodes
queueyarn queue <options>Prints queue information.-status <queueName>
version Prints current Hadoop version. 
envvars Displays current environment variables. 

The following screenshot shows how a command is fired on YARN:

When a command is run, the YARN client connects to the Resource Manager default port to get the details—in this case, node listing. More details about administrative and daemon commands can be read here.