Hive hiveserver2 and Web UI usage

posted on Nov 20th, 2016

Apache Hive

Apache Hive is a data warehouse infrastructure built on top of Hadoop for providing data summarization, query, and analysis. Hive gives an SQL-like interface to query data stored in various databases and file systems that integrate with Hadoop. The traditional SQL queries must be implemented in the MapReduce Java API to execute SQL applications and queries over a distributed data. Hive provides the necessary SQL abstraction to integrate SQL-like Queries (HiveQL) into the underlying Java API without the need to implement queries in the low-level Java API. Since most of the data warehousing application work with SQL based querying language, Hive supports easy portability of SQL-based application to Hadoop.

Pre Requirements

1) A machine with Ubuntu 14.04 LTS operating system

2) Apache Hadoop 2.6.4 pre installed (How to install Hadoop on Ubuntu 14.04)

3) Apache Hive 2.1.0 pre installed (How to Install Hive on Ubuntu 14.04)

Hive hiveserver2 and Web UI usage

HiveServer2 (HS2) is a server interface that enables remote clients to execute queries against Hive and retrieve the results (a more detailed intro here). The current implementation, based on Thrift RPC, is an improved version of HiveServer and supports multi-client concurrency and authentication. It is designed to provide better support for open API clients like JDBC and ODBC.

Step 1 - Change the directory to /usr/local/hive/bin

$ cd $HIVE_HOME/bin

Step 2 - Start hiveserver2 daemon

$ hiveserver2

OR

$ hive --service hiveserver2 &

Step 3 - You can browse to hiveserver2 web ui at following url

http://localhost:10002/hiveserver2.jsp

Step 4 - You can see the hive logs in

/tmp/hduser/hive.log

To kill hiveserver2 daemon

$ ps -ef | grep -i hiveserver2

$ kill -9 29707

OR

$ rm -rf /var/run/hive/hive-server.pid

There are many ways for hiveserver2 authentication process

You can see them in

$hive-site.xml

<property>
    <name>hive.server2.authentication</name>
    <value>NONE</value>
    <description>
      Expects one of [nosasl, none, ldap, kerberos, pam, custom].
      Client authentication types.
        NONE: no authentication check
        LDAP: LDAP/AD based authentication
        KERBEROS: Kerberos/GSSAPI authentication
        CUSTOM: Custom authentication provider
                (Use with property hive.server2.custom.authentication.class)
        PAM: Pluggable authentication module
        NOSASL:  Raw transport
    </description>
  </property>

1) If hive.server2.authentication is "NONE" in HIVE_HOME/conf/hive-site.xml then connect beeline with below url

!connect jdbc:hive2://

2) If value of "hive.server2.authentication" property in HIVE_HOME/conf/hive-site.xml to be set as "SASL" then connect hive beeline with below url

!connect jdbc:hive2://<host>:<port>/<db>

3) If "hive.server2.authentication" is nosasl then connect the beeline like below.

!connect jdbc:hive2://<host>:<port>/<db>;auth=noSasl

Make sure this property datanucleus.schema.autoCreateAll is true in hive-site.xml

<property>
<name>datanucleus.schema.autoCreateAll</name>
<value>true</ value>
<description> creates necessary schema on a startup if one does not exist. Set this to false, after creating it once </ description>
</property>

Please share this blog post and follow me for latest updates on

facebook             google+             twitter             feedburner

Previous Post                                                                                          Next Post

Labels : Hive Installation With Derby Database Metastore   Hive Installation With MySQL Database Metastore   Beeline Client Usage   WordCount hiveQL Execution   Hive Metastore Configuration   Hive Command Line Interface   Hive Shell Commands usage   Hive Distributed Cache   HDFS and Linux Commands in hive shell   Customizing hive logs   Database Commnds Usage   Table Commands Usage   Hive Partitioning Configuration   Hive Bucketing Configuration   UDFs Java Example   UDAFs Java Example   UDTF Java Example   Hive JDBC client Java Example   Hive Web Interface (HWI)   HiveQL Examples