How to backup and recover BindPlane OP when using PostgreSQL
When BindPlane OP is configured to use PostgreSQL as the storage backend, all data is stored in a database on the PostgreSQL system.
The PostgreSQL ecosystem is rich with backup tools. This guide will focus on the simplest approach, pgdump. You can use your favorite backup tooling as an alternative to pgdump.
- Command line access to the PostgreSQL database
pg_dump command, export the database named
bindplane to a file in the working directory.
1pg_dump --file bindplane-$(date '+%Y-%m-%d_%H:%M:%S').pgsql --dbname bindplane
Once finished, a file with the date will exist in the working directory. For example,
It is recommended that the exported database files be moved to a remote system, such as a backup server or a secure object storage service like Google Cloud Storage or Amazon S3.
To restore backup of the PostgreSQL database, use the following process:
- Stop the server:
sudo systemctl stop bindplane
- Ensure the target database exists
psqlto restore the backup:
psql -d bindplane < bindplane-2023-08-03_15:16:47.pgsql
- Start BindPlane:
sudo systemctl start bindplane