Database Backup for Polyspace Access Versions R2020a and Earlier
Note
This topic applies to Polyspace® Access™ versions R2020a and earlier. For versions R2020b and later, see Back Up Polyspace Access Database.
To create a backup of your Polyspace
Access database, use the pg_dumpall PostgreSQL utility. The utility creates a
dump of your database. You can then restore the state of the database from when the dump
was created. The pg_dumpall utility is available in the
polyspace-db container of Polyspace
Access.
Based on your database size and frequency of use, establish a policy for how often you create a backup. Users cannot interact with Polyspace Access while you perform a database backup or restore. Before you start a backup or restore operation, inform your users.
Create Database Backup
When you create a database backup, the pg_dumpall utility
generates a list of SQL commands that you use to reconstruct your database. The
backup operation requires superuser privileges. The privileges are set through
PostgreSQL and are separate from the user privileges on your system. For example, to
generate a database dump and save it as backup_db.sql, open a
terminal on the machine that hosts the Database service and
follow these steps.
To ensure that your backup does not contain partial or corrupted data, stop the ETL and Web Server services before starting the backup operation. In the terminal, enter this command:
docker stop polyspace-etl polyspace-web-server
Tip
Stopping the Polyspace Access services by using the Cluster Operator (COP) interface on Windows Server® 2019 might result in a slow response time. Instead, use these commands to stop the services:
docker exec -it polyspace-etl kill 1 docker exec -it polyspace-web-server kill 1
Generate the database backup and save it to
backup_db.sql.Thedocker exec polyspace-db pg_dumpall -U postgres > backup_db.sql
docker execcommand runs thepg_dumpallutility inside thepolyspace-dbcontainer. The-Uspecifies superuserpostgres. The output ofpg_dumpallis then saved asbackup_db.sql. Be aware that usingpg_dumpallon large databases might generate files that exceed the maximum file size limit on some operating systems and can be time consuming.To restart the ETL and Web Server services.
docker start polyspace-etl polyspace-web-server
Restore Database from Backup
To recover your data from a database backup, use the psql utility. This utility is available in the
polyspace-db container. The operation restores the data and
the user permissions for the Polyspace
Access projects. For example, you can restore your database from a backup
stored in file backup_db.sql. You complete some steps in the COP
interface. Other steps require a terminal on the server that hosts the
Database service.
Create a database. In the COP interface, delete all the services, then click Settings in the left pane. Under the Database settings, click create volume next to the Data volume field to create a volume, then select this volume from the Data volume drop-down list. If you do not see a create volume link, specify a new folder path in the Data volume field. If the folder path does not exist, the COP creates it. Save your changes.
Return to the Services tab, click PROVISION, then start only the Database service.
Restore the database from
backup_db.sql. In the terminal, enter this command:If you stored your backup in a compressed file, decompress the file, and then pipe its content to thedocker exec -i polyspace-db psql -U postgres postgres <backup_db.sql
docker execcommand. For instance, if you usegzip, to restore the database from filebackup_db.gz, enter:gzip -cd backup_db.gz | docker exec -i polyspace-db psql -U postgres postgres
In the COP interface, click START ALL to start all the services.
After the services start, open the Polyspace Access interface in your web browser to view the projects that were stored in the database up to when you created the backup.
Alternatively, you can rely on write ahead log (WAL) files to perform incremental backups and recoveries of your database. The WAL records all changes made to the database. The system stores only a few WAL files and recycles older files.
By creating a base backup and storing all subsequent WAL files, you can restore your database by replaying the WAL sequence up to any point between when you made your base backup and the present. For an example of how to configure an incremental backup, see Continuous Archiving and Point-in-Time Recovery (PITR).
See Also
Topics
- Storage and Port Configuration
- Install Polyspace Access for Web Reviews (Polyspace Bug Finder)