Skip to content

SerRichard/postgres-recovery-steps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

postgres-recovery-steps

Just a place to hold the yamls and readme for running a pg_restore fro ma pg-dump file. Also a tmp installation is included incase the recovery from a dump wants to be tested in isolation.

Run the recovery pod to run pg_restore.

Ensure the pg dump file is available on a local mount. Find the relevant volume using lsblk and mount the disk ( ex. /dev/vdc ) to a local path.

sudo mount /dev/vdc ~/tmp-data

We need to create the PV and PVC for the local mount where the dump file is available.

kubectl create -n tmp-psql -f volumes.yaml

Assuming we have a new minio service in the cluster as minio-sc. We need to register the two alias's, and then we can mirror the data.

kubectl create -n tmp-psql -f recovery.yaml

Clean up resources

kubectl delete -n tmp-psql -f recovery.yaml
kubectl delete -n tmp-psql -f volumes.yaml
sudo umount ~/tmp-data

Install a tmp postgresql instance ( if required )

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
kubectl create ns tmp-psql
microk8s helm3 install tmp-postgres bitnami/postgresql --namespace tmp-psql -f values.yaml

Exec into the deployed pod, login to psql and ensure the necessary db and db role are created.

CREATE database <DBNAME>;
CREATE ROLE <ROLE> WITH LOGIN PASSWORD <PASSWORD>;

Uninstall.

microk8s helm3 uninstall tmp-postgres -n tmp-psql

About

Run postgres recovery using a pg-dump file. Includes commands for a tmp psql installation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published