Restoring Cloudera Data Explorer (Hue)

The backup procedure automatically saved the Data Explorer database content and placed the content into the configured logs or data folders based on availability. Using the saved content, the restore process loads the data for the new Data Explorer deployments.

In the manual backup of Data Explorer, you followed steps to dump the entire Data Explorer database. In the following procedure, you move the Data Explorer backup file from the dump to the new Cloudera Data Warehouse environment.
  • Ensure that at least one Hive Virtual Warehouse or Impala Virtual Warehouse exists. Create a Virtual Warehouse if necessary.
  • Do not open the Data Explorer web interface prior to completing the steps below.
  • During the manual or automatic Data Explorer database restore operation it is critical to block any traffic to the running Data Explorer services. If you cannot bring down the cluster, use the recommended workaround to disable end user access to the cluster endpoints. Failing to do so results in errors in addition to existing key constraints and other issues.
  1. Copy the database backup files to the container.
    $ export VW=<virtual_warehouse_id>
    $ kubectl cp <local_backup_path>/hue_database_backup_schema-only.psql $VW/huebackend-0:/tmp/hue_database_backup_schema-only.psql -c hue
    $ kubectl cp <local_backup_path>/hue_database_backup.psql $VW/huebackend-0:/tmp/hue_database_backup.psql -c hue
  2. Go to Data Explorer container.
    $ kubectl -n $VW exec -i -t huebackend-0 --container hue -- /bin/bash
  3. Check the Data Explorer database configuration.
    $ vi /etc/hue/conf/zhuei.ini
    Example of content:
    [[database]]
    engine=postgres
    host="postgres-service"
    port=5432
    user="hive"
    password_script=/etc/hue/conf/altscript.sh hue_database_password
    name="warehouse-1702498325-gqmk_huedb"
  4. Get the Data Explorer database name and password.
    $ IFS="=" read nameKey HUEDB <<< $(cat /etc/hue/conf/zhue.ini | grep huedb | sed 's/"//g')
    $ /etc/hue/conf/altscript.sh hue_database_password; echo
  5. Resent the Data Explorer database and recreate tables.
    $ ./build/env/bin/hue reset_db -c --router=default
  6. Restore the Data Explorer database from the backup file.
    $ psql -d $HUEDB -h postgres-service -U hive < /tmp/hue_database_backup_schema-only.psql
    $ pg_restore -d $HUEDB -h postgres-service /tmp/hue_database_backup.psql -c -U hive
    $ ./build/env/bin/hue migrate