Restoring Lost PAS Data

Page last updated:

This guide explains how to use BOSH Backup and Restore (BBR) to restore a piece of Pivotal Application Service (PAS) data, such as a user or space, which has been lost.

Prerequisite

Restoring PAS data with BBR is only possible if you have previously taken a backup using the following command:

bbr director backup

This command produces a backup artifact in the format DIRECTOR_IP_TIMESTAMP/.

Validate Your Backup Artifact

Before restoring, verify that the backup artifact you have is suitable for your restore need. You can untar and explore the PAS backup artifact to verify that it contains the data that you need to restore.

Use any the checks in this section depending on the data you need to restore.

Verify an Org Is Present

To verify that your backup artifact contains the org you need to restore, do the following:

tar -xvf backup_restore-0-bbr-cloudcontrollerdb.tar
cat cloudcontroller-artifact-file | grep "ORG-TO-RESTORE"

Where ORG-TO-RESTORE is the org you need to restore.

If you see the following line in the output of the above command, then you can restore this org:

INSERT INTO `organizations` VALUES (..., ,'ORG-TO-RESTORE', ...);

Verify a Space Is Present

To verify that your backup artifact contains the space you need to restore, do the following:

tar -xvf backup_restore-0-bbr-cloudcontrollerdb.tar
cat cloudcontroller-artifact-file | grep "SPACE-TO-RESTORE"

Where SPACE-TO-RESTORE is the space you need to restore.

If you see the following line in the output of the above command, then you can restore this space:

INSERT INTO `spaces` VALUES (..., ,'SPACE-TO-RESTORE', ...);

Verify a User Is Present

To verify that your backup artifact contains the user you need to restore, do the following:

tar -xvf backup_restore-0-bbr-uaadb.tar
cat uaadb-artifact-file | grep "USER-TO-RESTORE"

Where USER-TO-RESTORE is the user you need to restore.

If you see the following line in the output of the above command, then you can restore this user:

INSERT INTO `users` VALUES (..., ,'USER-TO-RESTORE', ...);

Verify a Route Is Present

To verify that your backup artifact contains the route you need to restore, do the following:

tar -xvf backup_restore-0-bbr-cloudcontrollerdb.tar
cat cloudcontroller-artifact-file | grep "ROUTE-TO-RESTORE"

Where ROUTE-TO-RESTORE is the route you need to restore.

If you see the following line in the output of the above command, then you can restore this user:

INSERT INTO `routes` VALUES (..., ,'ROUTE-TO-RESTORE', ...);

Verify a Domain Is Present

To verify that your backup artifact contains the domain you need to restore, do the following:

tar -xvf backup_restore-0-bbr-cloudcontrollerdb.tar
cat cloudcontroller-artifact-file | grep "DOMAIN-TO-RESTORE"

Where DOMAIN-TO-RESTORE is the domain you need to restore.

If you see the following line in the output of the above command, then you can restore this domain:

INSERT INTO `domains` VALUES (..., ,'DOMAIN-TO-RESTORE', ...);

Verify an App Is Present

To verify that your backup artifact contains the app you need to restore, do the following:

tar -xvf backup_restore-0-bbr-cloudcontrollerdb.tar
cat cloudcontroller-artifact-file | grep "APP-TO-RESTORE"

Where APP-TO-RESTORE is the app you need to restore.

To verify that your blobstore backup artifact contains the droplet for the app you need to restore, do the following:

tar -xvf blobstore-backup.tar
tree blobstore-backup | grep "APP-DROPLET"

Where APP-DROPLET is the droplet for the app you need to restore.

If you see the following line in the output of the above command, then you can restore this app:

INSERT INTO `apps` VALUES (..., ,'APP-TO-RESTORE', 'APP-DROPLET', ...);

Note: If you use an external blobstore, go to your IaaS console and check the backup bucket to verify that the droplet is present.

Perform the Restore

Warning: BBR restore is a destructive process which removes any current data in your deployment. Performing a restore overwrites all new data since you created your most recent backup artifact.

Pivotal recommends that you verify the compatibility of your backup artifact by attempting the restore on an environment that is identical to the target environment. If this is not possible, refer to the Compatibility of Restore section of Restoring PCF from Backup with BBR to confirm that your backup is compatible with your restore environment.

Run a PAS restore by following the BBR instructions in Step 13: Restore PAS of Restoring PCF from Backup with BBR.

After a restore, PAS should roll back to its state at the time when the backup was taken, and contain the data that you had previously lost.

Consolidate Your Environment

If you have service instances that were not present when you performed the backup, then the BOSH service deployments become orphaned. PAS has no reference to these service deployments, but they continue to exist. You can locate orphaned service deployments using the BOSH command-line interface (CLI).

You can locate orphaned on-demand service instances by running the orphan-deployments errand. For more information, see Orphan Deployments in Broker and Service Management.