Understanding different components of Hive
Besides the Hive metastore, Hive components could be broadly classified as Hive clients and Hive servers. Hive servers provide interfaces to make the metastore available to external applications and check for user's authorization and authentication, and Hive clients are various applications used to access and execute Hive queries on the Hadoop cluster.
HiveServer
Let's take a look at its various components.
Hive metastore
Hive metastore URIs start a metastore service on the specified port. Metastore provides APIs to query the database, tables, schema, and other entities stored in the RDBMS datastore.
How to do it...
The metastore service starts as a Java process in the backend. You can start the Hive metastore service with the following command:
hive --service metastore &
HiveServer2
HiveServer2 is an interface that allows clients to execute Hive queries and get the result. It is based on Thrift RPC and supports multiple clients a against single client in HiveServer. It also provisioned for the authentication and authorization of the user.
How to do it...
The HiveServer2 service also starts as a Java process in the backend. You can start HiveServer2 with the following command:
hive --service hiveserver2 &
Hive clients
The following are the different clients available in Hive to query metastore data or to submit Hive queries to Hive servers.
Hive CLI
The following are the various sections included in Hive CLI.
Getting ready
Hive Command-line Interface (CLI) can be used to run Hive queries in either interactive or batch mode.
How to do it...
To run Hive CLI, use the following command:
$ HIVE_HOME/bin/hive
Queries are submitted by username of the user logged in to the UNIX system.
Beeline
The following are the various sections included in Beeline.
Getting ready
If you have configured HiveServer2, then a Beeline client can be used to interact with Hive.
How to do it...
To run Beeline, use the following command:
$ HIVE_HOME/bin/beeline
Using beeline, a connection could be made to any HiveServer2 instance with any username and password.