Non-Ambari Cluster Installation Guide
Also available as:
PDF
loading table of contents...

Configuring Hue for an External Database

By default, Hue uses an embedded database, SQLite 3.6, but you can configure Hue to use any of the following external databases:

Using Hue with Oracle

To set up Hue to use an Oracle database:

  1. Create a new user in Oracle and grant privileges to manage this database using the Oracle database admin utility:

    # sqlplus sys/root as sysdba 
    CREATE USER $HUEUSER IDENTIFIED BY $HUEPASSWORD default tablespace “USERS”temporary tablespace “TEMP”;
    GRANT CREATE TABLE, CREATE SEQUENCE, CREATE PROCEDURE, CREATE TRIGGER, CREATE SESSION,
    UNLIMITED TABLESPACE TO $HUEUSER;

    Where $HUEUSER is the Hue user name and $HUEPASSWORD is the Hue user password.

  2. Open the /etc/hue/conf/hue.ini file and edit the [[database]] section (modify for your Oracle setup).

    [[database]] 
    engine=oracle
    host=$DATABASEIPADDRESSORHOSTNAME
    port=$PORT 
    user=$HUEUSER 
    password=$HUEPASSWORD 
    name=$DBNAME
  3. Install the Oracle instant clients and configure cx_Oracle.

    1. Download and extract the instantclient-basic-linux and instantclient-sdk-linux Oracle clients from Oracle's download site.

    2. Set your ORACLE_HOME environment variable to point to the newly downloaded client libraries.

    3. Set your LD_LIBRARY_PATH environment variable to include ORACLE_HOME.

    4. Create symbolic link for library expected by cx_Oracle:

      ln -sf libclntsh.so.11.1 libclntsh.so

    5. Install the cx_Oracle python module. Confirm that python-setuptools are present on Hue node, for example, rpm -qa | grep python-setuptools.

      If the python-setuptools are not present, install them, using the following command:

      yum install python-setuptools

    6. Install the cx_Oracle module:

      /usr/lib/hue/build/env/bin/pip install cx_Oracle

    7. Upgrade Django south:

      /usr/lib/hue/build/env/bin/pip install south --upgrade

  4. Synchronize Hue with the external database to create the schema and load the data:

    /usr/lib/hue/build/env/bin/hue syncdb --noinput

    /usr/lib/hue/build/env/bin/hue migrate

  5. Populate /usr/lib64 with Oracle instant-client library files.

    Copy the *.so.* files from oracle instantclient directory path to /usr/lib64.

  6. Start Hue.

    /etc/init.d/hue start

Using Hue with MySQL

To set up Hue to use a MySQL database:

  1. Create a new user in MySQL, and grant privileges to it to manage the database using the MySQL database admin utility:

    # mysql -u root -p<
    CREATE USER $HUEUSER IDENTIFIED BY '$HUEPASSWORD';
    GRANT ALL PRIVILEGES on *.* to ‘$HUEUSER’@’localhost’ WITH GRANT OPTION;
    GRANT ALL on $HUEUSER.* to ‘$HUEUSER’@’localhost’ IDENTIFIED BY $HUEPASSWORD;
    FLUSH PRIVILEGES;

    where $HUEUSER is the Hue user name and $HUEPASSWORD is the Hue user password.

  2. Create the MySQL database for Hue:

    # mysql -u root -p

    CREATE DATABASE $DBNAME;

  3. Open the /etc/hue/conf/hue.ini file and edit the [[database]] section (modify for your MySQL setup).

    [[database]] 
    engine=mysql
    host=$DATABASEIPADDRESSORHOSTNAME
    port=$PORT
    user=$HUEUSER
    password=$HUEPASSWORD
    name=$DBNAME
  4. Synchronize Hue with the external database to create the schema and load the data.

    /usr/lib/hue/build/env/bin/hue syncdb --noinput

  5. Start Hue.

    /etc/init.d/hue start

Using Hue with PostgreSQL

To set up Hue to use a PostgreSQL database:

  1. Create a database in PostgreSQL using the PostgreSQL database admin utility.

    sudo -u postgres psql

    CREATE DATABASE $DBNAME;

  2. Exit the database admin utility.

    \q <enter>

  3. Create the Hue user.

    sudo -u postgres psql -d $DBNAME

    CREATE USER $HUEUSER WITH PASSWORD '$HUEPASSWORD';

    where $HUEUSER is the Hue user name and $HUEPASSWORD is the Hue user password.

  4. Open the /etc/hue/conf/hue.ini file and edit the [[database]] section (modify for your PostgreSQL setup).

    [[database]]
    engine=postgresql_psycopg2
    host=$DATABASEIPADDRESSORHOSTNAME
    port=$PORT
    user=$HUEUSER
    password=$HUEPASSWORD
    name=$DBNAME
  5. Install the PostgreSQL database adapter for Python (psycopg2). For RHEL/CentOS/Oracle Linux:

    yum install python-devel -y 
    yum install postgresql-devel -y 
    cd /usr/lib/hue 
    source build/env/bin/activate 
    pip install psycopg2 
  6. Synchronize Hue with the external database to create the schema and load the data:

    /usr/lib/hue/build/env/bin/hue syncdb --noinput

  7. Start Hue:

    /etc/init.d/hue start