This is the documentation for Cloudera 5.2.x.
Documentation for other versions is available at Cloudera Documentation.

The Hue Service

Configuring Hue to Work with High Availability

If your cluster has high availability enabled, you must configure the Hue HDFS Web Interface Role property to use HTTPFS. See Configuring Hue to Work with HDFS HA for detailed instructions.

Managing Hue Analytics Data Collection

Required Role:

Hue tracks anonymised pages and application versions in order to gather information to help compare each application's usage levels. The data collected does not include any hostnames or IDs. For example, the data is of the form: /2.3.0/pig, /2.5.0/beeswax/execute. You can restrict data collection as follows:
  1. Go to the Hue service.
  2. Click the Configuration tab.
  3. Expand the Service-Wide category.
  4. Uncheck the Enable Usage Data Collection checkbox.
  5. Click Save Changes to commit the changes.
  6. Restart the Hue service.

Using an External Database for Hue

Required Role:

By default, Cloudera Manager uses SQLite for the Hue database. If necessary, you can configure Cloudera Manager to use an external database such as MySQL or PostgreSQL as the database for Hue. The databases that Hue supports are listed at:

Dump the Hue Database

  1. In the Cloudera Manager Admin Console, go to the Hue service status page.
  2. Select Actions > Stop. Confirm you want to stop the service by clicking Stop.
  3. Select Actions > Dump Database. Confirm you want to dump the database by clicking Dump Database.
  4. Open the database dump file (by default /tmp/hue_database_dump.json) and remove all JSON objects with useradmin.userprofile in the model field. (You can verify the location of the database dump file by searching for Database Dump File in the Hue configuration settings.)

Configuring the Hue Server to Store Data in MySQL

  1. Install MySQL.
  2. Perform the steps in Dump the Hue Database.
  3. Create a new database and grant privileges to a Hue user to manage this database. For example:
    mysql> create database hue;
    Query OK, 1 row affected (0.01 sec)
    mysql> grant all on hue.* to 'hue'@'localhost' identified by 'secretpassword';
    Query OK, 0 rows affected (0.00 sec)
  4. In the Cloudera Manager Admin Console, click the Hue service.
  5. Click the Configuration tab.
  6. Expand the Service-Wide > Database category.
  7. Specify the settings for Hue Database Type, Hue Database Hostname, Hue Database Port, Hue Database Username, Hue Database Password, and Hue Database Name. For example, for a MySQL database on the local host, you might use the following values:
    Hue Database Type = mysql
    Hue Database Hostname = localhost
    Hue Database Port = 3306
    Hue Database Username = hue
    Hue Database Password = secretpassword
    Hue Database Name = hue
  8. Optionally restore the Hue data to the new database:
    1. Select Actions > Synchronize Database.
    2. Determine the foreign key ID.
      $ mysql -uhue -psecretpassword
      mysql > SHOW CREATE TABLE auth_permission;
    3. (InnoDB only) Drop the foreign key that you retrieved in the previous step.
      mysql > ALTER TABLE auth_permission DROP FOREIGN KEY content_type_id_refs_id_XXXXXX;
    4. Delete the rows in the django_content_type table.
      mysql > DELETE FROM hue.django_content_type;
    5. In Hue service instance page, click Actions > Load Database. Confirm you want to load the database by clicking Load Database.
    6. (InnoDB only) Add back the foreign key.
      mysql > ALTER TABLE auth_permission ADD FOREIGN KEY (content_type_id) REFERENCES django_content_type (id);
  9. Start the Hue service.

Configuring the Hue Server to Store Data in PostgreSQL

  1. Install PostgreSQL.
  2. Perform the steps in Dump the Hue Database.
  3. Install required packages.

    RHEL

    $ sudo yum install postgresql-devel gcc python-devel

    SLES

    $ sudo zypper install postgresql-devel gcc python-devel

    Ubuntu or Debian

    $ sudo apt-get install postgresql-devel gcc python-devel
  4. Install the Python module that provides the connector to PostgreSQL:
    • Parcel install
      $ sudo /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/pip install setuptools
      $ sudo /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/pip install psycopg2
    • Package install
      • CDH 4
        sudo -u hue /usr/share/hue/build/env/bin/pip install setuptools
        sudo -u hue /usr/share/hue/build/env/bin/pip install psycopg2
      • CDH 5
        sudo -u hue /usr/lib/hue/build/env/bin/pip install setuptools
        sudo -u hue /usr/lib/hue/build/env/bin/pip install psycopg2
  5. Install the PostgreSQL server.

    RHEL

    $ sudo yum install postgresql-server

    SLES

    $ sudo zypper install postgresql-server

    Ubuntu or Debian

    $ sudo apt-get install postgresql
  6. Initialize the data directories.
    $ service postgresql initdb
  7. Configure client authentication.
    1. Edit /var/lib/pgsql/data/pg_hba.conf.
    2. Set the authentication methods for local to trust and for host to password and add the following line at the end.
      host	hue	hue	0.0.0.0/0	md5
  8. Start the PostgreSQL server.
    $ su - postgres
    # /usr/bin/postgres -D /var/lib/pgsql/data > logfile 2>&1 &
  9. Configure PostgreSQL to listen on all network interfaces.
    1. Edit /var/lib/pgsql/data/postgresql.conf and set list_addresses.
      listen_addresses = ‘0.0.0.0’     # Listen on all addresses
  10. Create the hue database and grant privileges to a hue user to manage the database.
    # psql -U postgres
    postgres=# create database hue;
    postgres=# \c hue;
    You are now connected to database 'hue'.
    postgres=# create user hue with password 'secretpassword';
    postgres=# grant all privileges on database hue to hue;
    postgres=# \q
  11. Restart the PostgreSQL server.
    $ sudo service postgresql restart
  12. Verify connectivity.
    psql –h localhost –U hue –d hue 
    Password for user hue: secretpassword
  13. Configure the PostgreSQL server to start at boot.

    RHEL

    $ sudo /sbin/chkconfig postgresql on
    $ sudo /sbin/chkconfig --list postgresql
    postgresql          0:off   1:off   2:on    3:on    4:on    5:on    6:off

    SLES

    $ sudo chkconfig --add postgresql

    Ubuntu or Debian

    $ sudo chkconfig postgresql on
  14. In the Cloudera Manager Admin Console, click the Hue service.
  15. Click the Configuration tab.
  16. In the Category pane, click Advanced under Service-Wide.
  17. Specify the settings for Hue Server Configuration Advanced Configuration Snippet:
    [desktop]
    [[database]]
    host=localhost
    port=5432
    engine=postgresql_psycopg2
    user=hue
    password=secretpassword
    name=hue
  18. Click Save Changes.
  19. Optionally restore the Hue data to the new database:
    1. Select Actions > Synchronize Database.
    2. Determine the foreign key ID.
      bash# su – postgres
      $ psql –h localhost –U hue –d hue
      postgres=# \d auth_permission;
    3. Drop the foreign key that you retrieved in the previous step.
      postgres=# ALTER TABLE auth_permission DROP CONSTRAINT content_type_id_refs_id_XXXXXX;
    4. Delete the rows in the django_content_type table.
      postgres=# TRUNCATE django_content_type CASCADE;
    5. In Hue service instance page, Actions > Load Database. Confirm you want to load the database by clicking Load Database.
    6. Add back the foreign key you dropped.
      bash# su – postgres
      $ psql –h localhost –U hue –d hue 
      postgres=# ALTER TABLE auth_permission ADD CONSTRAINT content_type_id_refs_id_XXXXXX FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
  20. Start the Hue service.

Configuring the Hue Server to Store Data in Oracle

  1. Install Oracle.
  2. Ensure Python 2.6 or newer is installed on the server Hue is running on.
  3. Download the Oracle libraries at Instant Client for Linux x86-64 Version 11.1.0.7.0, Basic and SDK (with headers) zip files to the same directory.
  4. Unzip the Oracle client zip files.
  5. Set environment variables to reference the libraries.
    $ export ORACLE_HOME=oracle_download_directory 
    $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
  6. Create a symbolic link for the shared object:
    $ cd $ORACLE_HOME 
    $ ln -sf libclntsh.so.11.1 libclntsh.so
  7. Install the Python Oracle library: $ HUE_HOME/build/env/bin/pip install cx_Oracle
  8. Upgrade django south: $ HUE_HOME/build/env/bin/pip install south --upgrade
  9. Generate statements to delete all data from Oracle tables by running this query in the Oracle DB as the Hue schema user:
    > set page size 100
    > SELECT 'DELETE FROM ' || table_name || ';' FROM user_tables;
      Note: If you are logged into Oracle via sqlplus as the Hue schema user, some of these commands may hang. If that occurs, log out of sqlplus.
  10. Copy the statements from the previous step and run them in the Oracle DB as the Hue schema user.
  11. Stop the Hue service.
  12. Go to the Hue service in Cloudera Manager Admin Console and select Actions > Dump Database.
  13. Click the Configuration tab.
  14. Expand the Service-Wide > Advanced category.
  15. Set the Hue Service Environment Advanced Configuration Snippet (Safety Valve) property to
    ORACLE_HOME=oracle_download_directory
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:oracle_download_directory
  16. Set the Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini property with a [desktop] and [[database]] section similar to the following (modified accordingly for your Oracle setup):
    [desktop]
    [[database]]
    host=localhost
    port=1521
    engine=oracle
    user=hue
    password=secretpassword
    name=<SID of the Oracle database, for example, 'XE’>
    options={“threaded”:true}
    CDH 5.1 supports an Oracle service name. To use a service name, specify the following:
    [desktop]
    [[database]]
    port=0
    engine=oracle
    user=hue
    password=secretpassword
    name=oracle.test.com:1521/orcl.test.com
    options={“threaded”:true}
  17. Select Actions > Synchronize Database.
  18. Load the data that you dumped in step 10. Select Actions > Load Database. This step is not necessary if you have a fresh Hue install with no data or if you don’t want to save the Hue data.
  19. Start the Hue service.

Enabling Hue Applications

Required Role:

Most Hue applications are configured by default, based on the services you have installed. Cloudera Manager selects the service instance that Hue depends on. If you have more than one service, you may want to verify or change the service dependency for Hue. Also, if you add a service such as Sqoop 2 or Oozie after you have set up Hue, you will need to set the dependency because it won't be done automatically. To add a dependency:
  1. Go to the Hue service.
  2. Click the Configuration tab.
  3. Select the Service-Wide category.
  4. Change the setting for the service dependency from None to the appropriate service instance.
  5. Click Save Changes.
  6. Restart the Hue service.

Enabling the Sqoop 2 Application

If you upgrade to Cloudera Manager 4.7 from an earlier version of Cloudera Manager 4, you will need to set the Hue dependency to enable the Sqoop 2 application.

Enabling the HBase Browser Application

Required Role:

The HBase Browser application, new as of CDH 4.4, depends on the HBase Thrift server for its functionality.
  1. Add the HBase Thrift Server role.
  2. Configure Hue to point to the Thrift Server:
    1. Select the Hue service.
    2. Click the Configuration tab.
    3. Go to the Service-Wide category.
    4. For the HBase Service property, make sure it is set to the HBase service for which you enabled the Thrift Server role (if you have more than one HBase service instance).
    5. In the HBase Thrift Server property, click in the edit field and select the Thrift Server role that Hue should use.
    6. Save Changes.

Enabling the Solr Search Application

To use the Solr Search application with Hue, you must update the URL for the Solr Server in the Hue Server advanced configuration snippet. In addition, if you are using parcels with CDH 4.3, you must register the "hue-search" application manually or access will fail. You do not need to do this if you are using CDH 4.4 or later. See Deploying Solr with Hue for detailed instructions.