You can back up and restore databases.

Back Up a Database

To back up a database, run one of the following commands in the appliance:

  • For appliances on Horizon DaaS versions 9.0.0 (or Horizon Cloud 19.3) or later:
    /usr/local/desktone/scripts/backup_db.sh –P '<postgres_db_password>'  -U admin -V true --dbport 6432
    
  • For appliances on Horizon DaaS versions earlier than 9.0.0 (or Horizon Cloud 19.3):
    /usr/local/desktone/scripts/backup_db.sh –P '<postgres_db_password>' -U admin -V true 

This command extracts a PostgreSQL database into an archive file, creating a backup file of the form <hostname>.<timestamp>.tar.gz in the /usr/local/desktone/backup folder.

Note: '-V true' is an optional argument that enables verbose mode.

Restore a Database

The procedure below restores one database.

Note the following:

  • You must perform all restores on the primary appliance, and then reinitialize slony to populate the database to the secondary appliance.
  • If you must restore a tenant appliance, you might need to restore all databases (FDB, EDB, and AVDB).

To restore a database:

  1. Run sudo bash and authenticate.
  2. Stop dtService for both service provider appliances or for both tenant appliances:
    service dtService stop
  3. Stop slony:
    service dtService stop
    killall slon
  4. On the primary appliance, perform these steps.
    1. Copy the backup file to a directory in /tmp (the file has the form <hostname>.<timestamp>.tar.gz):
      mkdir /tmp/backup_working
      cp /usr/local/desktone/backup/<filename> /tmp/backup_working
      
    2. Extract the backup file:
       cd /tmp/backup_working
       tar zxvf <filename>
    3. Move to the directory where the .bak file exists and perform the restore.
      • For appliances on Horizon DaaS versions 9.0.0 (or Horizon Cloud 19.3) or later:
        cd usr/local/desktone/backup
        /usr/local/desktone/scripts/restore_db.sh -d <type> -p <pswd> --dbport 6432 -f <filename>
      • For appliances on Horizon DaaS versions earlier than 9.0.0 (or Horizon Cloud 19.3):
        cd usr/local/desktone/backup
        /usr/local/desktone/scripts/restore_db.sh -d <type> -p <pswd> -f <filename>

      Where:

      • <type> is the file type (either edb, fdb, or avdb).
      • <pswd> is the postgres database password.
      • <filenname> is the name of the extracted backup file.
  5. On both appliances, reinitialize slony. For instructions, see Initialize Slony for a Desktop Manager or Organization.
  6. Reboot both appliances.