The Hue Service
Hue is a set of web UIs that enable you to interact with a CDH cluster.
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
Minimum Required Role: Configurator (also provided by Cluster Administrator, Full Administrator)
- Go to the Hue service.
- Click the Configuration tab.
- Expand the Service-Wide category.
- Uncheck the Enable Usage Data Collection checkbox.
- Click Save Changes to commit the changes.
- Restart the Hue service.
Using an External Database for Hue
Minimum Required Role: Full Administrator
Configuring the Hue Server to Store Data in MySQL
- In the Cloudera Manager Admin Console, go to the Hue service status page.
- Select . Confirm you want to stop the service by clicking Stop.
- In the Status Summary, click a Hue Server instance.
- Select . Confirm you want to dump the database by clicking Dump Database.
- 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.)
- Configure MySQL to set strict mode:
[mysqld] sql_mode=STRICT_ALL_TABLES
- Create a new database and grant privileges to a Hue user to manage this database. For example:
mysql> create database hue CHARACTER SET utf8 COLLATE utf8_general_cs; 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)
- In the Cloudera Manager Admin Console, click the Hue service.
- Click the Configuration tab.
- Expand the category.
- 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 = host
- Hue Database Port = 3306
- Hue Database Username = hue
- Hue Database Password = secretpassword
- Hue Database Name = hue
- Optionally restore the Hue data to the new database:
- Select .
- Determine the foreign key ID.
$ mysql -uhue -psecretpassword mysql > SHOW CREATE TABLE auth_permission;
- (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;
- Delete the rows in the django_content_type table.
mysql > DELETE FROM hue.django_content_type;
- In Hue service instance page, click . Confirm you want to load the database by clicking Load Database.
- (InnoDB only) Add back the foreign key.
mysql > ALTER TABLE auth_permission ADD FOREIGN KEY (content_type_id) REFERENCES django_content_type (id);
- Start the Hue service.
Configuring the Hue Server to Store Data in PostgreSQL
- In the Cloudera Manager Admin Console, go to the Hue service status page.
- Select . Confirm you want to stop the service by clicking Stop.
- In the Status Summary, click a Hue Server instance.
- Select . Confirm you want to dump the database by clicking Dump Database.
- 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.)
- 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
- 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
- CDH 4
- Parcel install
- Install the PostgreSQL server.
RHEL
$ sudo yum install postgresql-server
SLES
$ sudo zypper install postgresql-server
Ubuntu or Debian
$ sudo apt-get install postgresql
- Initialize the data directories.
$ service postgresql initdb
- Configure client authentication.
- Edit /var/lib/pgsql/data/pg_hba.conf.
- 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
- Start the PostgreSQL server.
$ su - postgres # /usr/bin/postgres -D /var/lib/pgsql/data > logfile 2>&1 &
- Configure PostgreSQL to listen on all network interfaces.
- Edit /var/lib/pgsql/data/postgresql.conf and set list_addresses.
listen_addresses = ‘0.0.0.0’ # Listen on all addresses
- Edit /var/lib/pgsql/data/postgresql.conf and set list_addresses.
- 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
- Restart the PostgreSQL server.
$ sudo service postgresql restart
- Verify connectivity.
psql –h localhost –U hue –d hue Password for user hue: secretpassword
- 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
- In the Cloudera Manager Admin Console, click the Hue service.
- Click the Configuration tab.
- In the Category pane, click Advanced under Service-Wide.
- 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
- Click Save Changes.
- Optionally restore the Hue data to the new database:
- Select .
- Determine the foreign key ID.
bash# su – postgres $ psql –h localhost –U hue –d hue postgres=# \d auth_permission;
- Drop the foreign key that you retrieved in the previous step.
postgres=# ALTER TABLE auth_permission DROP CONSTRAINT content_type_id_refs_id_XXXXXX;
- Delete the rows in the django_content_type table.
postgres=# TRUNCATE django_content_type CASCADE;
- In Hue service instance page, . Confirm you want to load the database by clicking Load Database.
- 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;
- Start the Hue service.
Configuring the Hue Server to Store Data in Oracle (Parcel Installation)
- Ensure Python 2.6 or newer is installed on the server Hue is running on.
- Download and add the Oracle Client parcel to the Cloudera Manager remote parcel repository URL list and download, distribute, and activate the parcel.
- For CDH versions lower than 5.3, install the Python Oracle library: $ HUE_HOME/build/env/bin/pip install cx_Oracle
- Upgrade django south.
$ <HUE_HOME>/build/env/bin/pip install south --upgrade
- In the Cloudera Manager Admin Console, go to the Hue service status page.
- Select . Confirm you want to stop the service by clicking Stop.
- In the Status Summary, click a Hue Server instance.
- Select . Confirm you want to dump the database by clicking Dump Database.
- Click the Configuration tab.
- Set the Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini property. Add the following options (and modify accordingly for
your setup):
[desktop] [[database]] host=localhost port=1521 engine=oracle user=hue password=secretpassword name=<SID of the Oracle database, for example, 'XE'>
For CDH 5.1 and higher you can use an Oracle service name. To use the Oracle service name instead of the SID, use the following configuration instead:port=0 engine=oracle user=hue password=secretpassword name=oracle.example.com:1521/orcl.example.com
The directive port=0 allows Hue to use a service name. The name string is the connect string, including hostname, port, and service name.To add support for a multithreaded environment, set the threaded option to true under the [desktop]>[[database]] section.
options={'threaded':true}
- Grant required permissions to the Hue user in Oracle:
grant alter any index to hue; grant alter any table to hue; grant alter database link to hue; grant create any index to hue; grant create any sequence to hue; grant create database link to hue; grant create session to hue; grant create table to hue; grant drop any sequence to hue; grant select any dictionary to hue; grant drop any table to hue; grant create procedure to hue; grant create trigger to hue;
- Navigate to the Hue Server instance in Cloudera Manager and select .
- Generate statements to delete all data from Oracle tables:
- If you are connected to Oracle as the Hue user, run the following command:
SELECT 'DELETE FROM ' || table_name || ';' FROM user_tables;
- If you are connected to Oracle as a user that is not the Hue user, run the following command:
SELECT 'DELETE FROM ' || '<schema_name>.' || table_name || ';' FROM user_tables;
Where <schema_name> is the correct hue schema, typically: hue.
- If you are connected to Oracle as the Hue user, run the following command:
- Run the statements generated in the preceding step.
- Load the data that you dumped. Navigate to the Hue Server instance and select . 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.
- Start the Hue service.
Configuring the Hue Server to Store Data in Oracle (Package Installation)
If you have a parcel-based environment, see Configuring the Hue Server to Store Data in Oracle (Parcel Installation).
- 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.
- Unzip the Oracle client zip files.
- Set environment variables to reference the libraries.
$ export ORACLE_HOME=oracle_download_directory $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
- Create a symbolic link for the shared object:
$ cd $ORACLE_HOME $ ln -sf libclntsh.so.11.1 libclntsh.so
- Ensure Python 2.6 or newer is installed on the server Hue is running on.
- For CDH versions lower than 5.3, install the Python Oracle library: $ HUE_HOME/build/env/bin/pip install cx_Oracle
- Upgrade django south: $ HUE_HOME/build/env/bin/pip install south --upgrade
- In the Cloudera Manager Admin Console, go to the Hue service status page.
- Select . Confirm you want to stop the service by clicking Stop.
- In the Status Summary, click a Hue Server instance.
- Select . Confirm you want to dump the database by clicking Dump Database.
- Click the Configuration tab.
- Expand the category.
- 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
- Set the Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini property. Add the
following options (and modify accordingly for your setup):
[desktop] [[database]] host=localhost port=1521 engine=oracle user=hue password=secretpassword name=<SID of the Oracle database, for example, 'XE'>
For CDH 5.1 and higher you can use an Oracle service name. To use the Oracle service name instead of the SID, use the following configuration instead:port=0 engine=oracle user=hue password=secretpassword name=oracle.example.com:1521/orcl.example.com
The directive port=0 allows Hue to use a service name. The name string is the connect string, including hostname, port, and service name.To add support for a multithreaded environment, set the threaded option to true under the [desktop]>[[database]] section.
options={'threaded':true}
- Grant required permissions to the Hue user in Oracle:
grant alter any index to hue; grant alter any table to hue; grant alter database link to hue; grant create any index to hue; grant create any sequence to hue; grant create database link to hue; grant create session to hue; grant create table to hue; grant drop any sequence to hue; grant select any dictionary to hue; grant drop any table to hue; grant create procedure to hue; grant create trigger to hue;
- Navigate to the Hue Server instance in Cloudera Manager and select .
- Generate statements to delete all data from Oracle tables:
- If you are connected to Oracle as the Hue user, run the following command:
SELECT 'DELETE FROM ' || table_name || ';' FROM user_tables;
- If you are connected to Oracle as a user that is not the Hue user, run the following command:
SELECT 'DELETE FROM ' || '<schema_name>.' || table_name || ';' FROM user_tables;
Where <schema_name> is the correct hue schema, typically: hue.
- If you are connected to Oracle as the Hue user, run the following command:
- Run the statements generated in the preceding step.
- Load the data that you dumped. Navigate to the Hue Server instance and select . 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.
- Start the Hue service.
Enabling Hue Applications
Minimum Required Role: Configurator (also provided by Cluster Administrator, Full Administrator)
- Go to the Hue service.
- Click the Configuration tab.
- Select the Service-Wide category.
- Change the setting for the service dependency from None to the appropriate service instance.
- Click Save Changes.
- 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
Minimum Required Role: Full Administrator
- Add the HBase Thrift Server role.
- Configure Hue to point to the Thrift Server:
- Select the Hue service.
- Click the Configuration tab.
- Go to the Service-Wide category.
- 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).
- In the HBase Thrift Server property, click in the edit field and select the Thrift Server role that Hue should use.
- 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.