Back Up and Restore Internal Database
aan provides an out-of-the-box PostgreSQL internal database and a script to perform backup and restore of your database. We recommend that you regularly back up the database for safeguarding.
API Portal
provides an out-of-the-box PostgreSQL internal database and a script to perform backup and restore of your database. We recommend that you regularly back up the database for safeguarding. Currently, only the data inside the PostgreSQL database (service name ‘portaldb’) is backed up and restored by this feature.
The backup occurs on a source API Portal while the restore occurs on a target API Portal. The source and target can be the same API Portal.
We recommend the following steps:
- Set up a CRON job to schedule regular backups
- RSYNC the backup directory to a remote storage location
This article contains the following information:
Prerequisites
To back up and restore
API Portal
, you need the following privileges and files:- Root permission to runAPI PortalcommandNote:Non-root users must runAPI Portalcommands that are prepended with sudo.
- db-backup.sh
- db-restore.sh
The backup and restore script files are available in the
util
directory.Back Up the Database
This section describes how to back up the database.
Follow these steps:
- SSH into the system that is runningAPI Portal.
- Change the working directory to<installation_dir>/util.
- Execute the db-backup.sh script using the following command:./db-backup.shOnce executed, thepostgres_backup-<YYYY-mm-DD-HH-MM-SS>.sqlis created in the<installation_dir>/backupdirectory.CA recommends that the
directory is backed up to a remote location.<installation_dir>/backup
Restore the Database
This section describes how to restore the database to a previously backed up version.
Follow these steps:
- SSH into the system that is runningAPI Portal.
- Change the working directory to<installation_dir>/util.
- Execute the db-restore.sh script using the following command:./db-restore.sh ../backup/postgres_backup-2018-02-23-10-51-28.sql
- Wait for the restore to complete.
- Restart the Portal services by running the following command:./portal.sh