Backing up and restoring Hue documents in Cloudera Runtime

You can back up and restore Hue data, such as a Hive or Impala query you saved in a JSON document, in the Hue database to prevent losing the documents after rebuilding the Database Catalog.

In Hue, you can view the JSON documents you created or imported in My documents.

Avoid accessing or using the Hue web interface until the restore process is fully complete, as concurrent access may disrupt the operation and potentially lead to failure.

During the Hue database restore operation, it is critical to block any traffic to the running Hue 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. SSH into an active instance.
    ssh user@<hue-host>
  2. Navigate to the Hue environment directory.
    cd /opt/hive/build/env/bin
  3. Backup Hue documents you want to preserve from the command line.
    ./build/env/bin/hue dumpdata -o /tmp/hue_data_backup.json
  4. Verify backup file content.
    head /tmp/hue_data_backup.json
  5. Copy the backup file to a secure location.
    
    # On a local machine
    cp /tmp/hue_data_backup.json /backup/location/
    
    # On a remote server
    scp /tmp/hue_data_backup.json user@backup-server:/backup/location/
    
  6. Restore the Hue documents.
    1. Copy the backup JSON file back to the Hue host (if required).
      scp user@backup-server:/backup/location/hue_data_backup.json /tmp/
    2. Navigate to the Hue installation directory.
      cd /opt/cloudera/parcels/CDH/lib/hue
    3. Run the restore command.
      ./build/env/bin/hue loaddata --ignorenonexistent /tmp/hue_data_backup.json
  7. Restart the Hue service.
    systemctl restart hue

The saved queries, workflows, and dashboards are restored.

  • Perform regular backups (for example, weekly) to prevent accidental data loss.
  • Always restore to the same or a compatible Hue version.
  • Verify database connectivity and schema validity before restoration.
  • Restrict end-user access during the restore process to avoid conflicts.