How to configure automatic backups
PostgreSQL clusters are backed up with the Hikube backup service, from the Backups tab of the cluster page in the Hikube console.
Principle
- Full backups, scheduled or on demand, written to an S3 bucket in your project;
- Continuous archiving of transaction logs between two backups, which makes it possible to restore the database to a point in time;
- Retention in days, set by the destination.
Steps
- Create a destination in Infrastructure > Backups > Destinations: see Create a destination.
- Open PostgreSQL, the cluster, then the Backups tab.
- Click Schedule, choose the destination and the time pattern, then Schedule. See Schedule backups.
A single destination per cluster
All backups of a given PostgreSQL cluster must target the same destination: a second destination is refused.
On-demand logical backup
Independently of the backups managed by the platform, you can export a database at any time with the standard PostgreSQL tools:
# Export a database in custom format
pg_dump "host=<host> port=5432 dbname=myapp user=app_user sslmode=require" \
--format=custom --file=myapp-$(date +%F).dump
The user must have the Administrator (Admin) or Read-only right on the exported database.