ApsaraDB RDS for MySQL supports both automatic and manual backups. If the data of your RDS instance is lost or corrupted, you can restore the instance by using its backups. If your RDS instance is used with local SSDs, you can also retain its backups for a specific period of time after you release the instance.

For more information about how to back up your RDS instance in other database engines, see the following topics:

Note This topic describes the default backup function, which stores backups to the region where your RDS instance resides. You can also store backups to a different region. For more information, see Back up an ApsaraDB RDS for MySQL instance across regions.

Features

If your RDS instance is used with local SSDs, you can retain backups for a long period of time. In addition, you can specify a policy that is used to retain backups after you release the instance. This allows you to avoid data losses caused by unintended operations.

Billing

Each RDS instance is allocated a quota of free backup space. If your usage exceeds the capacity of the quota, you must pay for the extra backup space that you use. We recommend that you specify a backup cycle that best meets your business needs and maximizes the utilization of the free backup space. For more information about the quota of free backup space, see View the quota of free backup space for an ApsaraDB RDS for MySQL instance.

After the quota of free backup space is exhausted, your backups are charged based on the specified retention period. For more information about the pricing of regular backups that are retained for 730 days or less, visit ApsaraDB RDS for MySQL pricing. For more information about the pricing of archived backups that are retained for more than 730 days, see Pricing of Long-Term Backups on Alibaba Cloud International Site.

Precautions

  • Your RDS instance supports archived backups only when it is used with local SSDs.
  • Do not execute data definition language (DDL) statements during a backup. If you do so, the backup may fail due to table locks.
  • We recommend that you back up your RDS instance during off-peak hours.
  • If the data volume is large, backing up your RDS instance may require a long time.
  • Backups are retained based on the specified retention period. We recommend that you download the backups you require to your computer before they are deleted.
  • If the number of tables created on your RDS instance exceeds 50,000, you cannot restore individual databases or tables. If the number of tables exceeds 600,000, you cannot back up your RDS instance. In these cases, we recommend that you shard the databases on your RDS instance.

Overview of data and log backups

Data backup Log backup
You can back up the data of your RDS instance. This includes physical backup, logical backup, and snapshot backup. The data backup files can be used to restore your RDS instance. Your RDS instance performs physical or snapshot backup based on the storage media that you use:
  • MySQL 5.5, MySQL 5.6, MySQL 5.7, and MySQL 8.0 with local SSDs (in the High-availability or Enterprise Edition):
    • Support full physical backup when the automatic backup mode is enabled.
    • Support full physical backup, full logical backup, and single-database logical backup when the manual backup mode is enabled.
  • MySQL 5.7 and MySQL 8.0 with standard or enhanced SSDs (in the High-availability Edition):

    Support snapshot backup. Snapshot backups can be used to restore data to a new RDS instance. You cannot download these backups.

  • MySQL 5.7 and MySQL 8.0 with standard SSDs (in the Basic Edition):

    Support snapshot backup. Snapshot backups can be used to restore data to a new RDS instance. You cannot download these backups.

You can back up the binary logs of your RDS instance. The binary log files can be used to restore your RDS instance to a point in time. Your RDS instance automatically backs up its binary logs by default.
Note
  • Binary log files occupy disk space on your RDS instance.
  • If a binary log file reaches 500 MB in size or its write operation exceeds 6 hours, the system starts to write data into a new binary log file. The old binary log file is then asynchronously uploaded to Alibaba Cloud Object Storage Service (OSS).
  • After a binary log file is uploaded to OSS, it no longer occupies disk space on your RDS instance, but you can still use it for data restoration.
  • The Basic Edition does not support the upload of binary log files to OSS.
  • You cannot access the OSS buckets that store binary log files.

Configure a backup policy that is used to automatically back up your RDS instance

ApsaraDB for RDS automatically backs up your RDS instance based on the specified backup policy.

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.Select a region
  3. Find the target RDS instance and click its ID to open the Basic Information page.
  4. In the left-side navigation pane, click Backup and Restoration.
  5. On the Backup and Restoration page, click the Backup Settings tab and then the Edit button.Modify backup settings
  6. Configure the following parameters.
    Parameter Description
    Backup Cycle The cycle to create backups. You can select one or more days of a week.
    Note To ensure data security, we recommend that you back up your RDS instance at least twice a week.
    Backup Time The period of time during which you want to create a backup. We recommend that you select an off-peak hour.
    Retention period The period of time for which you want to retain backups. You can specify a specific number of days or select long term backup.
    • If you specify a specific number of days, the system deletes backups whose retention reaches the specified period. If you select the long term backup option, the system does not delete backups. If you want to retain backups after you release the RDS instance, set the Backup Retention Policy After Release parameter to Latest or All.
    • If the specified retention period does not exceed 730 days, backups are retained as regular backups.
    • If the specified retention period exceeds 730 days, backups whose retention exceeds 730 days are automatically converted into archived backups. Therefore, you must also specify an archived backup retention period.Configure the backup cycle
    Note This parameter is available only when the RDS instance is used with local SSDs.
    Log Backup The switch to enable or disable the log backup function.
    Notice If you disable this function, all binary log files are deleted, and you cannot restore the RDS instance to a point in time.
    Log Retention Period
    • The period of time for which you want to retain binary log files. Valid values: 7 to 730. Unit: days. Default value: 7.
    • The log retention period must be shorter than or equal to the data retention period.
    Note If the RDS instance runs MySQL 5.7 and the Basic Edition based on standard SSDs, the log retention period is fixed to seven days and cannot be changed.
    Restore Individual Database/Table This function is used to restore individual databases and tables. After you enable this function, the system changes the backup file format to support this function. By default, this function is enabled and cannot be disabled. For more information, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.
    Note This parameter is available only when the RDS instance is used with local SSDs.
    Backup Retention Policy After Release The policy that is used to retain data backup files after the RDS instance is released. Valid values: None, Latest, and All.

    To prevent data losses caused by overdue payments or unintended operations, we recommend that you select Latest or All.

    Note This parameter is available only when the RDS instance is used with local SSDs.

Manually back up your RDS instance

In this example, your RDS instance runs MySQL 5.7 and the High-availability Edition based on local SSDs.

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.Select a region
  3. Find the target RDS instance and click its ID to open the Basic Information page.
  4. In the upper-right corner of the page, click Back Up Instance.
  5. Select a backup mode and click OK.Physical backup
    Note If you select the Logical Backup mode and then the Single-Database Backup policy, you must also select the databases that you want to back up from the left-side list and click > to add them to the right-side list. If no databases are available, you must create databases. For more information, see Create databases and accounts for an ApsaraDB RDS MySQL instance.
    Single-database logical backup
  6. In the upper-right corner of the page, click the Task Progress button to view the progress of the backup task.View the progress of the backup task
    Note
    • After the backup task is complete, you can go to the Backup and Restoration page to download the data backup file. Some RDS instances do not support the download of backup files. For more information, see Download data backup files and binary log files.Download backup files
    • The retention period of manually created backups is determined by the Retention Period parameter. For more information, see the parameters described in step 6.

FAQ

  1. Can I disable the data backup function of my RDS instance?

    No, you cannot disable the data backup function of your RDS instance. However, you can reduce the backup frequency to as low as twice a week. The data backup retention period must span at least seven days.

  2. Can I disable the log backup function of my RDS instance?

    Yes, you can disable the log backup function of your RDS instance if you are not using the Basic Edition.

  3. Why did my backup task fail?

    You may have executed DDL statements when the backup task was being executed. DDL statements trigger locks on tables. Your backup task may have failed as a result of the table locks.

  4. Why does my RDS instance have a small volume of data but the size of the generated snapshot backup file is large?

    When creating a single snapshot backup, the system eliminates empty blocks. This allows the size of the snapshot backup file to be smaller than the available disk capacity. Each block is 2 MB in size. If write operations are dispersed, a large number of blocks are not full. For example, 3 MB of data may be written into two, three, or four blocks, and none of these blocks is full. When calculating the size of the snapshot backup file, the system considers all of these non-empty blocks to which data is written. As a result, the storage space occupied by the snapshot backup file is greater than the actual size of the snapshot backup file.

  5. After I release my RDS instance, how do I restore data by using a retained backup file?

    Log on to the ApsaraDB for RDS console and navigate to the Backup for Deleted Instances page. Then, download the backup file that you need and restore data to an on-premises database.

    Backup for Deleted Instances

References

Related operations

Operation Description
CreateBackup Creates a backup for an ApsaraDB for RDS instance.
DescribeBackups Queries the backups created for an ApsaraDB for RDS instance.
DescribeBackupPolicy Queries the backup settings of an ApsaraDB for RDS instance.
ModifyBackupPolicy Modifies the backup settings of an ApsaraDB for RDS instance.
DeleteBackup Deletes the data backup files of an ApsaraDB for RDS instance.
DescribeBackupTasks Queries the backup tasks created for an ApsaraDB for RDS instance.
DescribeBinlogFiles Queries the binary log files of an ApsaraDB for RDS instance.