pgRestore

pg_restore example

The script assumes you are going to restore to the primary example and that container is running and a backup has been created using the pgdump example..

This example assumes you have configured a storage filesystem as described in the link:/installation/storage-configuration/[Storage Configuration] document.

Successful use of the crunchy-pgrestore container will run a job to restore files generated by pg_dump/pg_dumpall to a container via psql/pg_restore; then container will terminate successfully and signal job completion.

For more information on how to configure this container, please see the link:/container-specifications/[Container Specifications] document.

To shutdown the instance and remove the container for each example, run the following:

./cleanup.sh

Docker

Run the restore with this command:

cd $CCPROOT/examples/docker/pgrestore
./run.sh

Kubernetes and OpenShift

By default, pgrestore container will automatically restore from the most recent backup. If you want to restore to a specific backup, edit the pgrestore.json file and update the PGRESTORE_BACKUP_TIMESTAMP setting to specify the backup path you want to restore with. For example:

"name":"PGRESTORE_BACKUP_TIMESTAMP",
"value":"2018-03-27-14-35-33"

Running the example:

cd $CCPROOT/examples/kube/pgrestore
./run.sh

The Kubernetes Job type executes a pod and then the pod exits. You can view the Job status using this command:

${CCP_CLI} get job

The pgrestore.json file within that directory specifies options that control the behavior of the pgrestore job.