Edit Page

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 namespace

To change the namespace for all subsequent kubectl commands to libre, run this command:

kubectl config set-context --current --namespace=libre

For a reference of useful kubectl commands, refer to the official kubectl Cheat Sheet.

Steps

To restore Audit PostgreSQL, follow these steps:

Steps

  1. Confirm the cluster and namespace are correct:

    ## context
    kubectl config current-context
    ## namespace
    kubectl get namespace
    

    To change the namespace for all subsequent kubectl commands to libre, run this command:

    kubectl config set-context --current --namespace=libre
    

    For a reference of useful kubectl commands, refer to the official kubectl Cheat Sheet.

  2. Retrieve the Audit user password using the following command:

    kubectl get secret <SECRET-NAME> -o jsonpath="{.data.<SECRET-KEY>}" | base64 --decode
    
  3. Extract your backup file:

    gzip -d audit-postgres-backup-YYYYMMDDTHHMMAA.sql
    
  4. Restore 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