Disaster Recovery

Disaster Recovery

With the Disaster Recovery, you can restore your Services Instances in case the whole system is not available anymore. To perform a Disaster Recovery, both the Backup Manager and the Service Instances need to be prepared:

Prepare a Service Instance

Preparing a Service Instance to be able to perform a Disaster Recovery requires that you have the following information available:

KeyDescryption
Backup Manager Instance GUIDThe Service Instance GUID provided by the Backup Manager.
Note: This GUID differs from the one given from the Service Broker.
Backup Encryption KeyThe Encryption Key used to encryt the Backups.
Service NameThe name of the service used to create the Service Instance.
Plan NameThe name of the plan used to create the Service Instance.
Custom Service ParametersCustom parameter set during creating or updating of the Service Instance.

CF Example:

cf create-service <service name> <plan_name> my_psql_service -c <custom service parameters>
cf create-service a9s-postgresql11 postgresql-replica-small my_psql_service -c '{"continuous_archiving": "enabled"}'

The Backup Manager API can be used both to change the Encryption Key, and to return the Backup Manager Instance’s GUID. It is worth noting that while the Backup Manager can change the Encryption Key, it does not return it, thus it is absolutely necessary to save it manually, and in a secure place.

API

Authentication

In order to use the API, you need to be authenticated and authorised. You will also need to create a cookie, which will store your authenticated session. The necessary steps to do so are explained in the Service Dashboard documentation under the topic API - How to access the API using cURL.

Endpoint

POST <dashboard_api_url>/backups/prepare_disaster_recovery

Parameters

NameTypeDescription
cf_instance_guidstringThe Service Instance GUID of the service instance.
encryption_keystringThe encryption key that will be used for future backups. (This parameter is optional)

Response:

KeyDescription
backup_guidThe GUID which the Backup Manager is using to refer to backups.
Note: This GUID is different than the GUID Cloud Foundry is using.

cURL Example

curl -X POST --cookie test.cookie --cookie-jar test.cookie --location --insecure \
  --header "Authorization: ${bearer_token}" \
  "${dashboard_api_url}/backups/prepare_disaster_recovery" \
  --data "encryption_key=${encryption_key}"

Perform the Disaster Recovery

To be able to perform a Disaster Recovery, you must first create a new Service Instance, in order to host the Service Instance that you want to recover. This requires the new Service Instance to be created in the same way it was before.

After that, a restore can be triggered, with the additional information shown below:

KeyDescryption
Backup File NameThe name of the Backup File which should be restored
Backup Manager Instance GUIDThe Instance GUID provided by the Backup Manager, to which the backup should be restored to.
Backup Encryption KeyThe Encryption Key used to decryt the Backup.

This can be done with either the CF Plugin or with the Backup Manager API.

API

Authentication

The authentication step is the same as the one shown here.

POST <dashboard_api_url>/backups/perform_disaster_recovery

Parameters

NameTypeDescription
cf_instance_guidstringThe Cloud Foundry GUID of the service instance.
backup_guidstringThe GUID which the Backup Manager is using to refer to backups.
Note: This GUID is different than the Cloud Foundry GUID of the Service Instance.
encryption_keystringThe encryption key that was used to encrypt the backups.

Example

Create new Service Instance

First, you create a the Service Instance needs, as shown in the example below:

cf create-service a9s-postgresql11 postgresql-replica-small my_recovered_psql_service -c '{"continuous_archiving": "enabled"}'

You can execute the following command to get the CF GUID of the new Service:

cf service my_recovered_psql_service --guid
Perform Disaster Recovery with cURL

In order to perform a Disaster Recovery via cURL, both the new CF GUID and the saved data from the preparement are required:

curl -X POST --cookie test.cookie --cookie-jar test.cookie --location --insecure \
  --header "Authorization: ${bearer_token}" \
  "${dashboard_api_url}/backups/perform_disaster_recovery" \
  --data "backup_guid=${backup_guids}" \
  --data "encryption_key=${encryption_key}"