In addition to regular backups, ApsaraDB RDS for PostgreSQL supports sparse backups. The sparse backup feature allows you to configure backup policies in a more flexible manner and retain the minimum number of backup sets. This reduces the period of time that is required to restore data from backup sets and reduces the storage costs of backup sets. This topic describes how to use the sparse backup feature.
Differences between regular backup and sparse backup
Item | Regular backup | Sparse backup |
Retention policy | Backup sets are retained based on the retention period that you specify, and at least two and up to seven backup sets must be retained every week. For example, a backup set is retained every Monday and Sunday for 365 days. | You can configure backup policies in a more flexible manner and retain the minimum number of backup sets. For example, a backup set is generated every Monday and Sunday and retained for seven days, and a backup set is generated on the last day of each month and retained for a long period of time. |
Storage cost | A large number of regular backup sets are generated, which increases storage costs. | The backup policies can be configured in a more flexible manner. The minimum number of backup sets is retained, which lowers storage costs. |
Prerequisites
The RDS instance uses cloud disks.
If this is the first time you use the backup feature of ApsaraDB RDS, you must attach the AliyunServiceRoleForDBS policy by using your Alibaba Cloud account. For more information, see How do I create a service-linked role for DBS?
The advanced backup settings are enabled. For more information, see Switch to the advanced backup settings.
NoteTo use the sparse backup feature, you must switch to the advanced backup settings and configure backup policies. For more information, see Procedure.
You can go to the Basic Information page of your RDS instance to view the preceding information.
Usage notes
After you configure a sparse backup policy, the configuration takes effect within approximately 10 to 15 minutes.
The backup policy in the first row is fixed and cannot be deleted. For the first backup policy, you must set the Backup Policy parameter to Every Week or High-frequency. After you select Every Week, you must also specify at least two days of a week.
If you configure more than one sparse backup policies to back up data on the same day, only one backup set is generated on the day and is retained based on the longest retention period among the policies.
If you delete a backup policy, the generated backup sets are still retained for the retention period for the policy. For more information, see Delete a backup policy.
After you configure sparse backup policies, if no backup set is created or dumped within the backup window on the day that you specify, the backup set on that day is skipped and no backup set is retained. This issue may occur due to various reasons, such as backup failure, the instance being locked, or the failure to dump the level-1 backup set within its validity period.
For example, you configure a backup policy to perform a backup on the first day of every month and retain the backup set for 30 days. If the backup fails on December 1, no backup set will be retained for that day.
Billing rules
A free quota on backup storage is provided for your RDS instance. If the total size of the backup files of your RDS instance does not exceed the free quota, no backup fees are generated. If the total size exceeds the free quota, you are charged for the excess backup storage that you use. For more information about the free quota and billing rules, see Backup storage fees.
Procedure
You must manually configure backup policies to retain the minimum number of backup sets.
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, click Backup and Restoration.
On the Backup and Restoration page, click the Backup Strategy tab and click the circled number between PostgreSQL and level-1 Backup.
In the dialog box that appears, click Add Backup Policy, configure sparse backup policies, and click OK.
Backup cycle
Backup time
Retention period
15 minutes to 12 hours
Data can be backed up at intervals that range from 15 minutes to 12 hours.
NoteYou can click the backup policy in the first row and change the value of the Backup Policy parameter from Every Week to High-frequency.
For more information, see Use the high-frequency snapshot backup feature.
You can configure a retention period for each backup policy. The retention period ranges from 7 to 7,300 days.
NoteYou can also select Long-term Retention to the right of a backup policy to retain backup sets for a long period of time.
Every Week
You can select one or more days of the week.
Every Month
You can select one or more days of the month or Last Day of Each Month.
Every Year
You can select a day of the year. For example, you can select January 1 of each year.
NoteFor more information about other parameters, see Back up an ApsaraDB RDS for PostgreSQL instance.
The backup policy in the first row is fixed and cannot be deleted. For the first backup policy, you must set the Backup Policy parameter to Every Week or High-frequency. After you select Every Week, you must also specify at least two days of a week.
Click Save in the lower-left corner of the Backup Strategy tab.
Examples
The preceding figure is used as an example to describe different backup policies.
1: Data is backed up every day of a week, and each backup set is retained for seven days.
2: Data is backed up every Monday, and the backup set is retained for 30 days.
3: Data is backed up on the first day and last day of each month, and the backup set is retained for 365 days.
4: Data is backed up once every year on January 1, and the backup set can be retained for a long period of time.
What to do next
Query backup policies
On the Backup Strategy tab, move the pointer over the circled number to view the backup policies that you configured.
The number in the circle indicates the number of backup policies that you configured.
Delete a backup policy
On the Level -1 Backup page, you can click the icon to delete a backup policy.
The backup policy in the first row is fixed and cannot be deleted. For the first backup policy, you must set the Backup Policy parameter to Every Week or High-frequency. After you select Every Week, you must also specify at least two days of a week.
Switch to the advanced backup settings
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, click Backup and Restoration.
On the Backup and Restoration page, click the Backup Strategy tab and click Switch to Advanced Backup Policy.
ImportantIf Switch to Advanced Backup Policy is not displayed on the tab, submit an application. After your application is approved, refresh the page.
In the dialog box that appears, select Understood and click OK.
ImportantAfter you switch to the advanced backup settings, you cannot switch back to the previous backup settings.
If the information similar to the following figure is displayed, the advanced backup settings are enabled. Then, you can configure a sparse backup policy. For more information, see Procedure.