The Web Browser as Hive Client - dummies

The Web Browser as Hive Client

By Dirk deRoos

Using the Hive CLI requires only one command to start the Hive shell, but when you want to access Hive using a web browser, you first need to start the HWI Server and then point your browser to the port on which the server is listening. The following figureillustrates how this type of Hive client configuration might work.

image0.jpg

Note that even though you might not be using the Hive CLI, it’s not an optional component and is still present.

The following steps show you what you need to do before you can start the HWI Server:

  1. Using the commands in the following listing, configure the $HIVE_HOME/conf/hive-site.xml file to ensure that Hive can find and load the HWI’s Java server pages.

              <property>
                 <name>hive.hwi.war.file</name>
                 <value>${HIVE_HOME}/lib/hive_hwi.war</value>
                 <description>This is the WAR file with the jsp
                 content for Hive Web Interface</description>
              </property>
  2. The HWI Server requires Apache Ant libraries to run, so you need to download more files. Download Ant from the Apache site.

  3. Install Ant using the following commands:

    mkdir ant
    cp apache-ant-1.9.2-bin.tar.gz ant; cd ant
    gunzip apache-ant-1.9.2-bin.tar.gz
    tar xvf apache-ant-1.9.2-bin.tar
  4. Set the $ANT_LIB environment variable and start the HWI Server by using the following commands:

    $ export ANT_LIB=/home/user/ant/apache-ant-1.9.2/lib
    $ bin/hive --service hwi
    13/09/24 16:54:37 INFO hwi.HWIServer: HWI is starting up
    ...
    13/09/24 16:54:38 INFO mortbay.log: Started SocketConnector@0.0.0.0:9999

In a production environment, you’d probably configure two other properties: hive.hwi.listen.host and hive.hwi.listen.port. You can use the first property to set the IP address of the system running your HWI Server, and use the second to set the port that the HWI Server listens on.

In this exercise, you use the default settings: With the HWI Server now running, you simply enter the URL http://localhost:9999/hwi/ into your web browser and view the metadata for our_first_table.

The following figure shows what the screen looks like after selecting the Browse Schema link followed by ourfirstdatabase and our_first_table.

image1.jpg

In production environments, working with the HWI Server can save you the time of loading the Hive distribution on every client — instead, you just point your browser to the server running the HWI. Additionally, you can use the HWI Server to view Hive Thrift Server diagnostics and query tables. The HWI Server allows you to set up batch sessions for long-running queries. To set up a session, you simply click the Create Session link.