Managing Backups and Recovery

When you take a backup, CDS makes a copy of the contents of the PostgreSQL PGDATA directory. The PGDATA directory contains the data and the meta-data required to construct an exact copy of the Postgres data cluster (the data and the database objects that reside within that Postgres instance).

Description of image

To capture a backup of a cluster, navigate to the Clusters tab, highlight a name in the cluster list, and click the Backup icon. The Backup Data? dialog opens as shown below:

Description of image

The Backup Data? dialog.

You can include a reference note about the backup that can be viewed on the Backups tab by adding a message to the Optional notes field on the Backup Data? dialog before clicking the Backup button.

When you click the Backup button, a backup will be created in the region where the master note resides. While CDS performs the backup, the PENDING column of the selected cluster (on the Clusters tab) will display the message, Backup in progress.

Performing a Base Backup for Point-In-Time Recovery

When point-in-time recovery is enabled, a base backup is automatically performed that can to be used to restore to a specific point in time. All subsequent automatic scheduled backups will also support point-in-time recovery. Note that if you deselect this option, the cluster (and subsequent automatic backups) will be re-configured to not include support for point-in-time recovery.

When point-in-time recovery is enabled, the value specified in the Backup Retention field of the Create cluster dialog determines the duration of the point-in-time recovery backup window. For example, if you specify a value of 7, the backup window will be 7 calendar days long. When the backup retention threshold is reached, the oldest base backup is removed, as well as any WAL files required to perform a recovery with that backup.

Please note that you cannot perform a base backup on a cluster while the database is in recovery and not accepting connections. If you attempt to perform a base backup during recovery, the backup will fail (the failure will be noted on the Events panel of the Clusters tab). You should instead wait until the database recovery is complete to enable point-in-time recovery for the cluster.

Point-in-time recovery is enabled on the Details panel of the Clusters tab. If a base backup fails, you can trigger CDS to perform a base backup by disabling point-in-time recovery, and then (after waiting a few minutes) re-enable point-in-time recovery.

Restoring a Cluster from Backup

You can use a template or manually provide cluster properties when restoring a cluster from a backup. To restore a backup into a new cluster, navigate to the Backups tab and highlight the name of a backup. Then, click the Recover Backup icon, located in the left margin. A dialog will open that allows you to select the method by which you will specify cluster preferences.

Description of image

Selecting a Restore option.

If you select the Restore From Template option on the recovery method dialog, a dialog opens that allows you to use a pre-defined template for the cluster configuration; for detailed information about using a template to clone a cluster, see Using a Template to Restore from Backup..

If you select Manually Restore A Backup, the following dialog opens.

Description of image

The Recover Data from a Backup dialog.

When the Recover Data from a Backup dialog opens:

  • If applicable, use the calendar selector in the Recovery Point field to specify the recovery target (the date and time that the database was in the state in which you wish the new cluster to start). The Recovery Point field is only displayed for backups that were taken with point-in-time recovery implemented; you cannot perform a point-in-time recovery with a backup unless point-in-time recovery is enabled for the cluster when the backup was taken.

  • Specify a name for the new cluster in the Cluster Name field.

  • Check the box next to Encryption to specify that the new cluster should reside in an encrypted cluster. Please note that you can restore a non-encrypted backup into an encrypted cluster.

  • Check the box next to Perform OS and Software update to instruct CDS to perform a yum update whenever the cluster is provisioned. Please note: this option is disabled if the database engine is statically provisioned.

  • Use the AZ drop-down listbox to the right of each node to select the availability zone in which the node will reside.

  • Use the Subnet drop-down listbox to the right of each node to select the subnet that the node will use.

  • Use the Server Class drop-down listbox to specify the server class of the new cluster.

  • If your cluster resides on an AWS host, check the box next to EBS Optimized to specify that your cluster should use an Amazon EBS-optimized instance and provisioned IOPS to guarantee a level of I/O performance;

    The IOPS field is enabled for those clusters that will reside on an EBS-optimized instance. If applicable, use the field to specify the level of I/O performance that will be maintained for the cluster by automatic scaling. The maximum value is 30 times the size of your cluster; for example, if you have a 4 Gigabyte cluster, you can specify a maximum value of 120.

    Note that you can increase the IOPS value of your cluster by recovering the cluster from a snapshot into a cluster with a higher value or cloning your database into a cluster with a higher IOPS value.

  • Check the box next to Continuous Archiving (Point-In-Time Recovery) to indicate that the new cluster should implement point-in-time recovery. Please note that to restore into a cluster with point-in-time recovery enabled, the backup from which you are restoring must have had point-in-time recovery implemented when the backup was taken. The checkbox will not be available if point-in-time recovery was not implemented when the backup was taken.

  • Use the Configure Network Security Rules section to provide security rules for the cluster; select Add Rule to open the Add Rule dialog and specify the Port number that will be available to the CIDR address specified on the dialog. Highlight a rule and select Delete Rule to remove a rule; you will be prompted to confirm the deletion before the rule is removed.

Click the Recover button to continue, or the Cancel button to exit without starting the recovery process. A popup confirms that the cluster is being restored; close the popup and navigate to the Clusters tab to monitor the restoration process.

Description of image

The recovery is in progress.

Please note: when you restore a backup, the server configuration will match the original configuration, but the server addresses will change.

Please note: when restoring a cluster from backup, you may need to modify parameters in the postgresql.conf file on the restored cluster to reflect the available memory of the new instance if the server class has changed from the original setting (the default value in the Server Class field). After modifying the server configuration, restart the server for the changes to take effect.

Using a Template to Restore from Backup

Templates can make restoring from a backup quicker and easier.

Description of image

Using a template to restore from a backup.

If you are using a template when restoring a cluster from backup, use the dialog shown above to provide the non-template details:

  • Use the Template Name drop-down listbox to select a template that will be used for the new cluster; to review the cluster details associated with the template, click the Full Template Details link.
  • Specify a name for the new cluster in the Cluster Name field.
  • Use the AZ drop-down listbox to the right of each node to select the availability zone in which the node will reside.
  • Use the Subnet drop-down listbox to the right of each node to select the subnet that the node will use.
  • Use the Configure Network Security Rules section to provide security rules for the cluster; select Add Rule to open the Add Rule dialog and specify the Port number that will be available to the CIDR address specified on the dialog. Highlight a rule and select Delete Rule to remove a rule; you will be prompted to confirm the deletion before the rule is removed.

When you’ve completed the dialog, click Recover to restore the backup.