You can back up and restore databases.

Back Up a Database

To back up a database, run the following command in the appliance:

/usr/local/desktone/scripts/backup_db.sh –P '<postgres_db_password>'

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.

Optional Commands - backup_db.sh accepts the following optional command line arguments.

Argument

Description

-P password

Password for database user admin

-V true

Enable verbose mode

-U username

PostgreSQL username (default is postgres).

Restore a Database

The procedure below restores one database.

Note the following:

  • You must perform all restores on the primary appliance, and then re-initialize slony to populate the database to the secondary appliance.

  • If you need to restore a tenant appliance, you might need to restore both the edb and fdb databases.

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, complete 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 example:

      cd usr/local/desktone/backup
      env PGPASSWORD=<pswd> /usr/local/pgsql/bin/pg_restore -i -w -U admin -d <type>
      -v --clean <filename>

      where:

      • <pswd> is the postgres database password

      • <type> is the file type (either edb, fdb, or avdb)

      • <filenname > is the name of the extracted backup file

  5. On both appliances, re-initialize slony. For instructions, see Slony Reinitialization.

  6. Reboot both appliances.