Complete the following steps to integrate Hue with Hive: 

1. Edit the hue.ini file

Complete the following steps in the beeswax section of the hue.ini file:

  1. Configure the hive_server_host and hive_server_port properties.  This step is not required on a single node cluster.

    [beeswax]
     
    # Host where HiveServer2 is running.
    # If Kerberos security is enabled, use fully-qualified domain name (FQDN).
      hive_server_host=<FQDN of Hive Server>
    
    # Port that HiveServer2 Thrift server runs on.
      hive_server_port=10000
  2. Verify that the path specified in the hive_conf_dir property applies to the Hive version that you have installed. If needed, update the path to reflect the Hive version that you have installed.

    # Hive configuration directory, where hive-site.xml is located
    hive_conf_dir=/opt/mapr/hive/hive-1.0/conf

    If Hue and Hive are installed on separate nodes, you must also copy the Hive conf directory to the Hue node. 
     

  3. For Hive 0.13: If you want to view logs during query execution, set use_get_log_api to true. From Hive 1.0 onward, this value does not need to be set to true in order to view the logs during query execution.  

    If you install Hue and Hive 0.13 with the MapR Installer, the MapR Installer automatically performs this step.  

2. Configure Data and Metadata Directories

When Hue and Hive are used together, they are usually configured to share metadata and data directories. However, you can create create separate directories for Hue and Hive.

The locations of the shared directories are specified by the following properties in the hive-site.xml file:

Configure Shared Hive Data and Metadata Directories for Hue

  1. Change the hive.metastore.uris property as shown:

    <property>
      <name>hive.metastore.uris</name>
      <value>thrift://localhost:9083</value>
      <description> URI where clients contact Hive metastore server </description>
    </property>

    The hive.metastore.warehouse.dir property can keep its default value and does not need to be changed.

  2. Enable Hue impersonation by setting the following property to true.

    <property>
      <name>hive.metastore.execute.setugi</name>
      <value>true</value>
      <description> Set this property to enable Hive Metastore service impersonation in unsecure mode.
       In unsecure mode, setting this property to true causes the metastore to execute DFS operations
       using the client's reported user and group permissions. Note that this property must be set on
       BOTH the client and server sides. </description>
    </property>
  3. Set the location of the sharelib.

    <property>
      <name>oozie.service.WorkflowAppService.system.libpath</name>
      <value>/oozie/share/lib</value>
    </property>
  4. To enable the Hive Metastore service to share the embedded Derby database, add the following property blocks to the hive-site.xml file on the node running hiveserver2 to point to the location of the Derby metastore:

    <property>
      <name>javax.jdo.option.ConnectionURL</name>
      <value>jdbc:derby:;databaseName=/<local dir>/metastore_db;create=true</value>
      <description>JDBC connect string for a JDBC metastore</description>
    </property>
    
    <property>
      <name>javax.jdo.option.ConnectionDriverName</name>
      <value>org.apache.derby.jdbc.EmbeddedDriver</value>
      <description>Driver class name for a JDBC metastore</description>
    </property>
  5. To enable the Hive Metastore service to share a MySQL database, add the following property blocks to the hive-site.xml file:

    <property>
      <name>javax.jdo.option.ConnectionURL</name>
      <value>jdbc:mysql://<ip_address>:3306/hive_11?createDatabaseIfNotExist=true</value>
    </property>
    
    <property>
      <name>javax.jdo.option.ConnectionDriverName</name>
      <value>com.mysql.jdbc.Driver</value>
    </property>
    
    <property>
      <name>javax.jdo.option.ConnectionUserName</name>
      <value><UserName></value>
      <description>Substitute the actual username</description>
    </property>
    
    <property>
      <name>javax.jdo.option.ConnectionPassword</name>
      <value><Password></value>
      <description>Substitute the actual password</description>
    </property>

Configure Separate Hive Data and Metadata Directories for Hue:

If you want to store Hue data and metadata in separate directories from Hive data and metadata, follow these steps:

  1. Copy hive-site.xml to a new location. (The original hive-site.xml file remains in the previous location for use by Hive.)
  2. Edit hue.ini and change the hive_conf_dir property so it points to the new location for hive-site.xml.
  3. Change the hive.metastore.warehouse.dir property in the new hive-site.xml file so it points to the directory where Hue data will be located.
  4. Change the hive.metastore.uris property so it points to the directory for Hue's metastore_db.
  5. Set the hive.metastore.execute.setugi property to true, as shown in step 2 above.

3. Additional Configurations

Perform any additional Hue configurations and then restart Hue so that the changes will take effect.  See Starting the Hue Webserver