Command Line Installation
Also available as:
PDF
loading table of contents...

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. 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:

    cd /usr/lib/hue
    source build/env/bin/activate
    hue syncdb --noinput
    hue migrate
    deactivate