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:
- Run sudo bash and authenticate.
- Stop dtService for both service provider appliances or for both tenant appliances:
service dtService stop
- Stop slony:
service dtService stop killall slon
- On the primary appliance, perform these steps.
- 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
- Extract the backup file:
cd /tmp/backup_working tar zxvf <filename>
- 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.
- For appliances on Horizon DaaS versions 9.0.0 (or Horizon Cloud 19.3) or later:
- Copy the backup file to a directory in /tmp (the file has the form <hostname>.<timestamp>.tar.gz):
- On both appliances, reinitialize slony. For instructions, see Initialize Slony for a Desktop Manager or Organization.
- Reboot both appliances.