get Oracle SmartView plugin

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.

Using the Hive command

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 hiveserver1hiveserver2 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

The following two tables list the commonly-used commands in different command modes considering different user preferences:

Purposehiveserver2 - beelinehiveserver1 - hive
Connect serverbeeline –u <jdbc_url>hive -h <hostname> -p <port>
Helpbeeline -hhive -H
Run querybeeline -e "hql query"
beeline -f hql_query_file.hql
beeline -i hql_init_file.hql
hive -e "hql query"
hive -f hql_query_file.hql
hive -i hql_init_file.hql
Setvariablebeeline --hivevar var_name=var_valuehive --hivevar var_name=var_value
Purposehiveserver2 - beelinehiveserver1 - hive
Enter modebeelinehive
Connect server!connect <jdbc_url>N/A
List tables!table
show tables; --also support
show tables;
List columns!column table_name
desc table_name;
desc table_name;
Run queryselect * from table_name;select * from table_name;
Save result!record result_file.dat
Run shell cmd!sh ls!ls;
Run dfs cmddfs -ls;dfs -ls;
Run hql file!run hql_query_file.hqlsource hql_query_file.hql;
Quit mode!quitquit;

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
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