Restore Audit backup
This guide shows you the procedure to restore your Audit PostgreSQL database in your Rhize Kubernetes deployment.
Prerequisites
Before you start, ensure you have the following:
Also, before you start, confirm you are in the right context and namespace.
## context
kubectl config current-context
## namespace
kubectl get namespaceTo change the namespace for all subsequent kubectl commands to libre, run this command:
kubectl config set-context --current --namespace=libreFor a reference of useful kubectl commands, refer to the official kubectl Cheat Sheet.
Steps
To restore Audit PostgreSQL, follow these steps:
Steps
Confirm the cluster and namespace are correct:
## context kubectl config current-context ## namespace kubectl get namespaceTo change the namespace for all subsequent
kubectlcommands tolibre, run this command:kubectl config set-context --current --namespace=libreFor a reference of useful
kubectlcommands, refer to the official kubectl Cheat Sheet.Retrieve the Audit user password using the following command:
kubectl get secret <SECRET-NAME> -o jsonpath="{.data.<SECRET-KEY>}" | base64 --decodeExtract your backup file:
gzip -d audit-postgres-backup-YYYYMMDDTHHMMAA.sqlRestore the backup:
cat audit-postgres-backup-YYYYMMDDTHHMMAA.sql | kubectl exec -i audit-postgres-0 -- psql postgresql://postgres:<DB_PASSWORD>@localhost:5432 -U <DB_USER_NAME>
Next Steps
- Test the Backup Audit procedure
- Plan and execute a Maintenance Strategy to handle your audit data.