Restore a Backup
|Restore operation will create a new PostgreSQL instance with new credentials|
Backups are tied to instances
Restorations can only be triggered from an instance in the same namespace. If the old instance has already been deleted the backups are deleted as well.
Get the ID of the backup you want to restore by listing all available backups.
kubectl -n <your-namespace> get vshnpostgresbackups BACKUP NAME DATABASE INSTANCE STORED TIME STATUS AGE pgsql-app1-prod-pk8k4-2023-03-05-13-05-00 pgsql-app1-prod 2023-03-05T13:05:15.755Z Completed 38s pgsql-app1-dev-pk8k4-2023-03-01-16-52-11 pgsql-app1-dev Failed 28s
This list will show all backups from all instances in this namespace. In the example above there are two database instances with one backup each.
Apply the following object on your namespace, as specified by its YAML description.Example to restore a PostgreSQL instance. Update the namespace!
apiVersion: vshn.appcat.vshn.io/v1 kind: VSHNPostgreSQL metadata: name: pgsql-app1-restore namespace: <your-namespace> spec: parameters: restore: claimName: pgsql-app1-prod (1) backupName: pgsql-app1-prod-pk8k4-2023-03-01-16-52-02 (2) backup: schedule: '0 22 * * *' service: majorVersion: "15" pgSettings: timezone: Europe/Zurich size: cpu: "600m" memory: "3500Mi" disk: "80Gi" writeConnectionSecretToRef: name: postgres-creds-restored compositionRef: name: vshnpostgresrestore.vshn.appcat.vshn.io (3)
1 The name of the instance you want to restore from 2 The backup name you want to restore 3 You need to specify that this is not a normal instance but a restored one
The restore process is the same as ordering a new instance. The only difference is the backup information in
The deletion process of a restored instance is the same as for normal instance. Check out this guide how to delete a PostgreSQL instance.