Redgate Clone

Backup Application Database

Redgate Clone uses in-cluster Postgres database to store application data such as data image and data container metadata. If this data is lost or corrupted the rgclone CLI may be unable to access existing data images and data containers or even to connect to Redgate Clone at all.

This page describes the process for backing up and restoring data stored in the application database.

Prerequisites

For security and convenience it's best to run the instructions on a VM that hosts Redgate Clone.

Postgresql CLI tools

The process uses psql and pq_dump CLI tools. They can be installed using:

sudo apt-get install postgresql-client

Database Password

To connect to the application database you need the database password. To get the password run the following command:

kubectl get secret cloning-capability-infra-secret -n redgate-clone-app  -o jsonpath='{.data.database_password}' | base64 --decode

Port Forwarding

By default the database service is not available externally. To be able to connect to it from the VM run the following command:

kubectl port-forward clone-postgresql-0 5432:5432 -n redgate-clone-app

This is a blocking operation, so it has to be run in a separate console. If postgres database service is restarted for some reason, you'll need to re-run the port-forwarding command again.

Taking a backup

To create a backup run the following command:

pg_dump -a -U postgres -p 5432 -h localhost config > rgclone.bak

This will store all application data in the rgclone.bak file. (You can use a different file name.) The backup won't include database schema.

Restoring a backup

Before restoring a backup you need first to resart the clone-api service to ensure that the database schema is in place:

kubectl rollout restart deployment clone-api -n redgate-clone-app

After that you can restore data from the back up to the application database:

psql -U postgres -p 5432 -h localhost -d config < config.bak


Didn't find what you were looking for?