AGILITY Backup and Restore
AGILITY uses Databases to persist data. This guide explains how to configure backup and how to restore based on agility-services
database solution.
agility-services
uses PGO to manage Database instances. PGO uses pgBackRest for backup management. Detailed information about Database backup options can be found on:
S3 Backup configuration for AGILITY
AGILITY provides local backup per default and it is suggested not to change this setting. However, it is possible to optionally enable remote S3 backup.
Create a kubernetes secret named
agility-db-backup
with the remote S3 credentials.Declare the S3 credentials as environment variables and the namespace where AGILITY is installed
export NS=agility export S3_BACKUP_CREDENTIALS_FILE=/tmp/s3-backup.ini export S3_ACCESS_KEY=<Access key> export S3_ACCESS_KEY_SECRET=<Secret access key>
Store in a temporary file the S3 credentials with the following format
cat <<EOF > ${S3_BACKUP_CREDENTIALS_FILE} [global] repo2-s3-key=${S3_ACCESS_KEY} repo2-s3-key-secret=${S3_ACCESS_KEY_SECRET} EOF
Create the kubernetes secret
kubectl --namespace ${NS} create secret generic agility-db-backup --from-file=s3.conf=${S3_BACKUP_CREDENTIALS_FILE}
Define backup override values file
Define the required information
As per
pgBackRest
documentation,S3_URI_STYLE
should be eitherhost
orpath
. Usuallypath
is the preferred option:S3 URI Style. The following URI styles are supported: host - Connect to bucket.endpoint host. path - Connect to endpoint host and prepend bucket to URIs.
Declare the file
Run the Helm command to deploy agility-services:
Once deployed, check backup configuration is healthy
Output should be the following:
Enforce first full backup execution on the S3 bucket
A new pod will be created, wait until it gets
Completed
status
S3 Backup verification
Once S3 backup is configured, it is possible to verify the current status:
Expected output should be similar to the following message:
Restore AGILITY
agility-services
database can be restored in place.
Define the time
agility-services
database will be restoredFrom PGO documentation:
"To perform a Pont In Time Recovery (PITR), you must have a backup that finished before your PITR time. In other words, you can’t perform a PITR back to a time where you do not have a backup!"
Update the same values file it was created to backup configuration.
Open with your preferred edit the values file
Add the
restore
section underpostgrescluster.pgbackrest.otherSpec
:
Note
--target
option must be changed with your defined dateRun the Helm command to deploy agility-services:
Annotate
agility-db
postgrescluster to start restore processWait until restoration job finish and gets terminated
Output should be similar to the following code block
Once restoration jobs is Terminated, agility-db pod will be created and restored with data from the selected date
Recreate affected services
Once AGILITY is available, disable restoration to avoid undesired restoration
Set
postgrescluster.pgbackrest.otherSpecs.restore.enabled: false
onagility-services-values-backup.yaml
file
Run the Helm command to deploy agility-services: