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:
yarn application <command> <parameters>
All actions pertaining to applications such as print and kill.
- appID <applicationID> - kill <applicationID> - list - status <applicationID>
yarn applicationattempt <parameter>
Prints an application attempt(s) report.
yarn classpath --jar <path>
Prints the classpath needed for the given JARor prints the current classpath set when passed without a parameter.
-all prints it for all nodes - list - lists all nodes
yarn queue <options>
Prints queue information.
Prints current Hadoop version.
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.
Hive first started with hiveserver1. However, this version of Hive server was not very stable. It sometimes suspended or blocked the client’s connection quietly. Since v0.11.0, Hive has included a new thrift server called hivesever2 to replace hiveserver1. hiveserver2 has an enhanced server designed for multiple client concurrency and improved authentication. It also recommends using beeline as the major Hive command-line interface instead of the hive command. The primary difference between the two versions of servers is how the clients connect to them. hive is an Apache-Thrift-based client, and beeline is a JDBC client. The hive command directly connects to the Hive drivers, so we need to install the Hive library on the client. However, beeline connects to hiveserver2 through JDBC connections without installing Hive libraries on the client. That means we can run beeline remotely from outside the cluster. For more usage of hiveserver2 and its API access, refer to https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients.
The following two tables list the commonly-used commands in different command modes considering different user preferences:
In addition, Hive configuration settings and properties can be accessed and overwritten by theSET keyword in the interactive mode. For more details, refer to the Apache Hive wiki at https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties. For beeline, ; is not needed after the command that starts with !. Both commands do not support running a pasted query with <tab> inside, because <tab> is used for auto-complete by default in the environment. Alternatively, running the query from files has no such issues. In interactive mode, we can use the keyboard’s up and down arrow keys to retrieve the previous commands. The !history command can be used in beeline to show the command’s history. In addition, the dfs command may be disabled in beeline for permissions control in some Hadoop distributions. Both commands support variable substitution, which refers to https://cwiki.apache.org/confluence/display/Hive/LanguageManual+VariableSubstitution.