Automatic backup and manual backup are supported for ApsaraDB RDS for MySQL instances and serverless ApsaraDB RDS for MySQL instances. This topic describes how to back up an RDS instance. You can configure a backup policy that allows the system to automatically back up your RDS instance.
For more information about how to use the automatic backup feature for an RDS instance that runs a different database engine, see the following topics:
Introduction to backups
You can back up your RDS instance by using one of the following methods:
ApsaraDB RDS: The system provides a default backup feature that supports full data backups and incremental log backups.
DBS: Database Backup (DBS) provides the logical backup feature. The feature supports advanced capabilities such as cross-account backup, backup of individual databases or tables, cross-region backup, and storage of backup files in an Object Storage Service (OSS) bucket.
For more information about the differences between the default backup feature of ApsaraDB RDS and the logical backup feature of DBS, see Differences between default RDS backups and advanced DBS backups.
Use ApsaraDB RDS to perform automatic backups
ApsaraDB RDS supports automatic data backups and automatic log backups. Log backups are also referred to as incremental backups. Data backups cannot be disabled. However, you can change the data backup frequency based on your business requirements. For more information, see Composition.
Instance category | Minimum frequency | Maximum frequency |
| Twice every week | Once every day. |
RDS instances that run RDS High-availability Edition or RDS Cluster Edition with cloud disks | Once every 15 minutes. You must enable the Increase Snapshot Frequency feature. |
Prerequisites
The AliyunServiceRoleForDBS service-linked role is created by using your Alibaba Cloud account if you use the backup feature of ApsaraDB RDS for the first time. For more information, see How do I create a service-linked role for DBS?
Usage notes
If the minor engine version of your RDS instance meets the following conditions, the RDS instance cannot be backed up after it is locked:
Any minor engine version if the RDS instance runs MySQL 5.1 or MySQL 5.5.
20190815 or earlier if the RDS instance runs MySQL 5.6, MySQL 5.7, or MySQL 8.0.
NoteFor more information about how to upgrade the major engine version or update the minor engine version of an RDS instance, see Upgrade the major engine version or Update the minor engine version.
For more information, see What do I do if my ApsaraDB RDS instance is in the Locking state?
You can configure a binlog retention policy for a read-only RDS instance but cannot configure an automatic backup policy for the read-only RDS instance. For more information, see Delete the binary log files of an ApsaraDB RDS for MySQL instance.
Do not execute DDL statements during a backup operation. If DDL statements are executed during a backup operation, the relevant tables are locked and the backup operation fails.
We recommend that you back up data during off-peak hours.
number of tables that are created on your RDS instance exceeds 600,000, you cannot back up the data. In this case, we recommend that you shard the databases on your RDS instance.
NoteLog on the ApsaraDB RDS console. Click the ID of your RDS instance. On the page that appears, click Log On to Database. After you log on to the RDS instance, you can view the numbers of databases and tables that are created on your RDS instance.
If the number of tables that are created on your RDS instance exceeds 50,000, you cannot restore individual databases or tables. For more information, see Restore individual databases and tables.
After you modify the automatic backup policy for your RDS instance, the system initiates a full backup.
Procedure
In some regions, you can use the spare backup feature by enabling the advanced backup settings on the Backup Strategy tab. If you cannot find the entry point to enable the advanced backup settings on the Backup Strategy tab, submit an application. For more information, see Switch to the advanced backup settings and Use the spare backup feature. After you enable the advanced backup settings, the entry point to configure backup policies and the method to configure some parameters are changed. You must configure the backup policies and parameters based on your business requirements.
Regular backup (before the upgrade)
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. In the Basic Backup section, click Edit.
Configure the following parameters and click OK.
NoteIf your RDS instance uses cloud disks, the system creates snapshots to back up the data of the RDS instance.
Table 1. Data backup settings
Instance category
Parameter
Description
All RDS instances
Data backup retention period
The number of days for which backup files are retained. Default value: 7. Valid values:
For RDS instances that use cloud disks: 7 to 730.
NoteIf your RDS instance runs MySQL 5.7 on RDS Basic Edition, the value is fixed as 7.
If you enable the single-digit second backup feature, the value of this parameter ranges from 7 to 730.
For RDS instances that use local disks: 7 or more. The value must be less than 2 to the power of 31.
Data backup files that are retained for 730 days or less are considered regular backup files.
Data backup files that are retained for more than 730 days are converted into archived backup files. The cost of archived backup files is less than the cost of regular backup files. For more information, see Backup storage fees.
NoteIf you set this parameter to a value greater than 730 or select Permanently Retained Before Instance Release, you must specify the number of archived backup files to retain. For example, if you select Monthly and enter 2 in the unit field, the system retains the first two archived backup files that are generated each month.
Backup Cycle
The cycle based on which data backups are created. You must select at least two days of the week.
Start At
The time at which a data backup starts. For example, you can select 08:00. We recommend that you select an off-peak hour.
Retain Backup Files after Instance Release
Specifies whether to retain backup files after the RDS instance is released.
NoteWe recommend that you select Latest or All. After your RDS instance is released, you can go to the Backup for Deleted Instances tab to download the backup files of your RDS instance. Then, you can use the backup files to restore the data of your RDS instance. For more information, see Method 2: Configure the backup retention policy after the instance is released.
If your RDS instance uses local disks and runs RDS Enterprise Edition, this parameter is unavailable.
RDS instances that use local disks
Restore Individual Database/Table
Specifies whether to enable the restoration feature for individual databases and tables. For more information, see Restore individual databases and tables The restoration feature for individual databases and tables is automatically enabled and cannot be disabled.
NoteThe restoration feature for individual databases and tables is supported for RDS instances that run MySQL 8.0, MySQL 5.7, or MySQL 5.6 on RDS High-availability Edition and use local disks.
After you enable the restoration feature for individual databases and tables, a new backup file format takes effect. For more information, see [Product changes/Feature changes] New physical backup file format is phased in for some ApsaraDB RDS for MySQL instances.
Fast Restoration
Specifies whether to enable the fast restoration feature for individual databases and tables. If you enable the fast restoration feature for individual databases and tables, the data is restored at a fast speed. If you disable the fast restoration feature, the data is restored at a standard speed. For more information, see Restore individual databases and tables.
Standard: Data is restored at a standard speed.
Fast: Data is restored at a speed that is 50% to 95% faster than standard restoration.
NoteIf you enable the fast restoration feature for individual databases and tables, you must also configure the CDM Billing Method and CDM Retention Period parameters.
The fast restoration feature for individual databases and tables is not supported in some Alibaba Cloud regions.
RDS instances that use cloud disks
Backup within Seconds
Specifies whether to enable the single-digit second backup feature. If the feature is enabled, a snapshot backup can be completed within a few seconds.
NoteThis feature is supported for RDS instances that run RDS High-availability Edition with enhanced SSDs (ESSDs) or run RDS Cluster Edition.
Increase Snapshot Frequency
The frequency at which snapshot backups are created. You can configure a shorter interval to create snapshots by using the single-digit second backup feature, which increases the frequency of the snapshots. You can increase the frequency to up to once every 15 minutes. For more information, see Use the high-frequency snapshot backup feature.
NoteThis feature is supported for RDS instances that run RDS High-availability Edition with cloud disks or run RDS Cluster Edition.
Before you can use this feature, you must enable the single-digit second backup feature. If the single-digit second backup feature is disabled, the system automatically enables the single-digit second backup feature when you enable the high-frequency snapshot backup feature.
Fast Database/Table Restoration
Specifies whether to enable the fast restoration feature for individual databases and tables. Fast restoration provides a restoration speed that is 50% to 95% faster than standard restoration. For more information, see Restore individual databases and tables.
NoteThe fast restoration feature for individual databases and tables is not supported in some Alibaba Cloud regions.
Table 2. Log backup settings
Log Backup Settings (Log Backup regular Edition)
Parameter
Description
Log Backup
Specifies whether to enable the log backup feature. After the feature is enabled, you can restore the data of your RDS instance to a point in time. This feature is enabled by default.
Log Backup Retention Period (Days)
The valid value ranges from 7 to 730. Default value: 7.
The log backup retention period must be less than or equal to the data backup retention period.
NoteIf your RDS instance runs MySQL 5.7 on RDS Basic Edition, the value is fixed as 7.
Configure the PITR feature (enhancement of the log backup feature)
The PITR feature is supported for RDS instances that reside in specific regions. For more information about the differences between the PITR and log backup features, the description of the PITR feature, and the RDS instances for which the PITR feature can be enabled, see Configure the PITR feature.
ImportantTo implement PITR, the system retains additional backup sets based on the value of the Time Range of Specific Points in Time for Restoration parameter.
For example, if you set the Time Range of Specific Points in Time for Restoration parameter to 7, the system retains the backup sets for 7 to 9 days. The system retains an additional full backup for more than seven days and all consecutive log backups generated from the seventh day to the day in which the last full backup is generated. You are charged for the storage of one full backup and additional log backups that are generated within one week at most.
Parameter
Description
Restoration to Specific Point in Time
Specifies whether to enable the PITR feature. After the feature is enabled, you can restore the data of your RDS instance to any point in time. The feature is an enhancement of the log backup feature. By default, Time Range of Specific Points in Time for Restoration is turned on for new RDS instances.
Time Range of Specific Points in Time for Restoration
The number of days during which you can restore data of your RDS instance to any point in time. If the value of this parameter is modified, the retention period of log backups is also modified.
Valid values: 7 to 730. Default value: 7.
The value must be less than or equal to the retention period of full backups.
NoteIf your RDS instance runs MySQL 5.7 on RDS Basic Edition, the value is fixed as 7.
Sparse backup (after the upgrade)
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. On the tab that appears, click the circled number between MySQL and Level-1 Backup to view the backup policies that you configured.
Configure the following parameters and click OK.
Table 1. Data backup settings
Instance category
Parameter
Description
All RDS instances
Backup Policy
The time range within which the backup is performed and the retention period of the backup sets. The backup must be performed at least twice a week.
NoteYou can click Add Backup Policy to configure the sparse backup feature. This way, you can configure backup policies in a more flexible manner and retain the minimum number of backup sets. For more information, see Use the sparse backup feature.
Start At
The time at which a data backup starts. For example, you can select 08:00. We recommend that you select an off-peak hour.
Retain Backup Files after Instance Release
Specifies whether to retain backup files after the RDS instance is released.
NoteWe recommend that you select Latest or All. After your RDS instance is released, you can go to the Backup for Deleted Instances tab to download the backup files of your RDS instance. Then, you can use the backup files to restore the data of your RDS instance. For more information, see Method 2: Configure the backup retention policy after the instance is released.
If your RDS instance uses local disks and runs RDS Enterprise Edition, this parameter is unavailable.
RDS instances that use local disks
High-frequency Incremental Backup
The frequency at which backups are performed. After you enable this feature, the minimum frequency is every hour. For more information, see Use the high-frequency physical backup feature.
NoteThis feature is supported for RDS instances that run MySQL 5.6, MySQL 5.7, and MySQL 8.0 on RDS High-availability Edition with local disks.
Backup Encryption Status
Specifies whether to enable the backup encryption feature. For more information, see Use the backup encryption feature.
RDS instances that use cloud disks
Backup within Seconds
Specifies whether to enable the single-digit second backup feature. If the feature is enabled, a snapshot backup can be completed within a few seconds.
NoteThis feature is supported for RDS instances that run RDS High-availability Edition with ESSDs or run RDS Cluster Edition.
Fast Database/Table Restoration
Specifies whether to enable the fast restoration feature for individual databases and tables. Fast restoration provides a restoration speed that is 50% to 95% faster than standard restoration. For more information, see Restore individual databases and tables.
NoteThe fast restoration feature for individual databases and tables is not supported in some Alibaba Cloud regions.
Table 2. Log backup settings
Parameter
Description
Log Backup
Specifies whether to enable the log backup feature. After the feature is enabled, you can restore the data of your RDS instance to a point in time. This feature is enabled by default.
Log Backup Retention Period (Days)
The retention period of the log backups. The log backup retention period must be less than or equal to the data backup retention period. Valid values: 7 to 7300. Unit: days. Default value: 7.
NoteIf your RDS instance runs MySQL 5.7 on RDS Basic Edition, the value is fixed as 7.
On the Backup Strategy tab, click Save in the lower-left corner.
Use DBS to perform automatic backups
DBS allows you to create and configure a backup schedule by using the logical backup feature to automatically back up an RDS instance or a self-managed MySQL instance. For more information, see Back up an ApsaraDB RDS for MySQL instance or a self-managed MySQL database by using logical backup.
What to do next
Perform a manual backup. In addition to the automatic backup feature that is described in this topic, you can manually back up all databases or individual databases and tables of an RDS instance. For more information, see Manually back up an ApsaraDB RDS for MySQL instance.
Download existing data backup files or log backup files to your on-premises device for archiving, or download backup files and upload the backup files to OSS buckets. For more information, see Download backup files.
Use data backups and log backups to restore data to an existing RDS instance, a new RDS instance, or a self-managed MySQL instance. For more information, see Overview of data restoration methods.
The automatic backup feature that is provided by ApsaraDB RDS stores backup files in the same region as your RDS instance. For more information about how to store backup files in a region that is different from the region of your RDS instance, see Use the cross-region backup feature.
You can also call the following API operations to manage the backup policy of an RDS instance or configure a DBS backup schedule:
Category
Operation
Description
ApsaraDB RDS
Modifies the backup settings of an instance.
Queries the backup settings of an instance.
Queries a list of backup sets.
Queries the backup tasks of an instance.
DBS
Creates a DBS backup schedule.
Configures a DBS backup schedule.
FAQ
Does the backup task affect the performance of my RDS instance?
RDS edition
Impact
RDS High-availability Edition, RDS Cluster Edition, or RDS Enterprise Edition
Backup operations are performed on the secondary RDS instance. In this case, the operations do not occupy the CPU resources or affect the performance of the primary RDS instance.
NoteIn rare cases when the secondary instance is unavailable, backups are performed on the primary instance.
If an RDS instance runs RDS Basic Edition, the instance stands alone. All backup operations are performed on the RDS instance. In this case, the performance of the RDS instance decreases during a backup.
Can I disable the data backup feature or the log backup feature?
You cannot disable the data backup feature for your RDS instance but you can reduce the data backup frequency to at least twice a week and retain the data backup files for at least seven days. You can disable the log backup feature for your RDS instance on the Backup Strategy tab.
Why does my backup task fail?
You executed time-consuming DDL statements or UPDATE statements when your backup task was in progress. These statements triggered locks on tables, and your backup task failed as a result of the locks.
Why is the size of a snapshot backup file significantly larger than the amount of data on my RDS instance?
The size of backup files may not equal the amount of data on your RDS instance. If your RDS instance uses cloud disks, the system creates snapshots to back up your RDS instance. The size of a snapshot backup file may be significantly larger than the amount of data. The free quota on backup storage for an RDS instance that uses cloud disks is 200% of the storage capacity of the RDS instance. The free quota on backup storage for an RDS instance that uses local disks is 50% of the storage capacity of the RDS instance.
NoteWhen the system calculates the size of a snapshot backup file, the system counts in all the non-empty blocks to which data is written. If the write operations are scattered among blocks, none of the blocks is empty. For example, if 3 MB of data is written across two, three, or four blocks, none of these blocks is empty. In this case, the system counts in all these blocks to calculate the total size. As a result, the size of the snapshot backup file is larger than the actual amount of data.
Therefore, the total size of all backup sets that is displayed on the Backup and Restoration page in the ApsaraDB RDS console may be inconsistent with the amount of storage consumed by backups.