This topic describes how to retain the backup files of an ApsaraDB RDS for MySQL instance for a long period of time. The long-term retention of backup files helps you restore your data and protect your data assets.
Background information
When you use ApsaraDB RDS, you may encounter the following issues:
Your data is unexpectedly deleted. However, only the backup files that are generated over the most recent seven days are retained. As a result, you cannot restore the data that was generated seven days ago.
Your RDS instance has been released due to unintended operations or overdue payments for a long period of time. As a result, you cannot recover your data or backup files.
You want to release your RDS instance but retain its backup files for future use.
Method 1: Increase the backup retention period
You can increase the backup retention period to restore earlier data.
This operation increases the size of your backup files and may also increase the storage costs of your RDS instance. For more information, see View and manage the size of backup files and Backup storage fees.
- 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.
In the dialog box that appears, manually increase the data backup retention period or the log backup retention period. For example, you can increase the value from the default value 7 to 30.
NoteThe log backup retention period cannot be longer than the data backup retention period.
If your RDS instance uses local disks, you can select Permanently Retained before Instance Release. After you select Permanently Retained before Instance Release, you do not need to specify the data backup retention period. All data backup files are retained. For more information, see Use the automatic backup feature.
Click OK.
Method 2: Configure the backup retention policy after the instance is released
In most cases, after your RDS instance expires or becomes overdue, the system retains your RDS instance and its backup files based on the retention period that you specify. After the retention period elapses, the system releases your RDS instance and deletes its backup files. For more information, see Overdue payments. To resolve this issue, you can configure a backup retention policy for your RDS instance. After the configuration, the backup files of the RDS instance are retained for a long period of time even if the RDS instance is released.
Prerequisites
Your RDS instance meets the following requirements:
The RDS instance runs MySQL 8.0, MySQL 5.7, or MySQL 5.6
The RDS instance uses local disks or cloud disks.
The RDS instance runs RDS Basic Edition, RDS High-availability Edition, or RDS Cluster Edition.
You can go to the Basic Information page of your RDS instance to view the preceding information.
Billing rules
If your RDS instance is deleted, the backup files of the RDS instance are retained free of charge within seven days. After the 7-day retention period elapses, you are charged for the storage of the backup files. For more information about billing rules, see Billing rules.
Usage notes
On the Details page of the Alibaba Cloud console, the ID of the Database Backup (DBS) backup schedule that you purchase to back up an RDS instance is displayed in one of the following formats:
A string that starts with dbs. Example:
dbsrkzl******
.If the ID is in this format, you cannot identify the RDS instance for which the DBS backup schedule is purchased.
A string that starts with dbs followed by the name of an RDS instance. Example:
dbs:rm-bpXXXXXX
.If the ID is in this format, you can identify the RDS instance for which the DBS backup schedule is purchased.
Procedure
- 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.
In the dialog box that appears, set Retain Backup Files after Instance Release to Latest or All.
NoteAfter the configuration, if your RDS instance is released, the backup files of your RDS instance are retained for a long period of time. You cannot specify the retention period. You can go to the Backup for Deleted Instances tab to download the backup files of your RDS instance and use the backup files to restore the data of your RDS instance. You can also modify the backup retention policy of your RDS instance to Delete All Backups (Cannot be Restored) based on your business requirements.
Click OK.
Method 3: Download a backup file
You can download a backup file of your RDS instance to your computer or to your Elastic Compute Service (ECS) instance. The backup file can be stored on your computer or ECS instance for a long period of time. For more information, see What is ECS? and Download backup files.
FAQ
The Retain Backup Files after Instance Release parameter is set to Latest for my RDS instance before the RDS instance is released. Where is the retained backup file stored?
After your RDS instance is released, you can go to the Backup for Deleted Instances tab to download the backup file of your RDS instance. Then, you can use the backup file for restoration.
My RDS instance is released but storage fees are still generated. Why?
A backup retention policy may be configured for your released RDS instance. The backup files of the RDS instance are retained after the RDS instance is released, and fees are generated for the retention of the generated backup files. Therefore, even if your RDS instance is released, the storage fee will appear on the subsequent bills. For more information, see Retain the backup files for a long period of time.
NoteIf you do not want to retain the backup files after your RDS instance is released, you can go to the Backup for Deleted Instances tab to modify the backup retention policy of the RDS instance to Delete All Backups (Cannot be Restored) based on your business requirements.
I plan to release my RDS instance but I want to restore the backup files of my RDS instance after the instance is released. How do I back up the RDS instance to prevent data loss?
Method 1: You can download the existing backup sets of your RDS instance in the ApsaraDB RDS console, restore the downloaded backup sets to a self-managed MySQL instance, and then restore the backup data of the self-managed MySQL instance to the required RDS instance. For more information, see Download backup files, Restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL database, and Restore the data of a self-managed MySQL instance to an ApsaraDB RDS for MySQL instance. If you want to download the most recent backup data of your RDS instance, you can perform the operations that are described in Manually back up an ApsaraDB RDS for MySQL instance.
Method 2: Before you release your RDS instance, specify the retention period of the backup files after the instance is released. After you specify the retention period, the backup files of your RDS instance are retained regardless of whether the RDS instance is released. For more information, see Method 2: Configure the backup retention policy after the instance is released.
For more information, see Methods of backing up and restoring an ApsaraDB RDS for MySQL instance and Overview of data restoration methods.