ApsaraDB RDS for MySQL supports automatic and manual backups. If the data of your RDS instance is lost or corrupted, you can restore the instance from available backup files. If your RDS instance uses local SSDs, you can retain the backup files for a specific period of time after the instance is released.

For more information about how to back up an RDS instance that runs another database engine, see the following topics:

Note This topic describes the default backup feature. This feature allows you to store the backup files of your RDS instance to the same region as the instance. You can also store backup files to a different region. For more information, see Back up an ApsaraDB RDS for MySQL instance across regions.

Functionality

Billing

Each RDS instance is allocated a free quota for backup storage. If your backup storage usage exceeds the free quota, you are charged extra fees. We recommend that you specify a proper backup cycle based on your business requirements to maximize the usage of the free backup storage. For more information about the free quota for backup storage, see View the free quota for backup storage of an ApsaraDB RDS for MySQL instance.

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

Precautions

  • Your RDS instance supports archived backup files only when the instance uses local SSDs.
  • You can specify the backup settings of your RDS instances only when the instance is a primary instance. Read-only RDS instances do not support backup settings.
  • When a backup is in progress, you must not execute data definition language (DDL) statements. These statements trigger locks on tables, and the backup may fail as a result of the locks.
  • We recommend that you back up your RDS instance during off-peak hours.
  • If your RDS instance has a large amount of data, a backup may require a long period of time.
  • Backup files are retained based on the specified retention period. Before the retention period elapses, we recommend that you download the required backup files to your computer.
  • 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 of an ApsaraDB RDS for MySQL instance. 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

    Data backups are copies of the data in the databases on your RDS instance. These backups include physical, logical, and snapshot backups. You can use these backups to restore the data of your RDS instance. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance. Your RDS instance automatically creates physical or snapshot backups based on the type of storage media that you use. For more information, see Storage types.

    • Local SSDs (High-availability or Enterprise Edition)
      • Your RDS instance supports full physical backups in automatic backup mode.
      • Your RDS instance supports full physical backups, full logical backups, and single-database logical backups in manual backup mode.
    • Standard or enhanced SSDs (Basic or High-availability Edition)

      Your RDS instance supports only snapshot backups. You can use snapshot backup files to restore data to a new RDS instance. You cannot download snapshot backup files.

  • Log backup

    Log backups are copies of the binary logs that are generated on your RDS instance. You can use log backup files to restore the data of your RDS instance to a specific point in time. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance. Your RDS instance automatically backs up the binary logs of your RDS instance.

    • Log backup files occupy the storage space of your RDS instance.
    • If the size of a log backup file reaches 500 MB or the duration of write operations to the file reaches 6 hours, your RDS instance starts to write data to a new log backup file. The old log backup file is then asynchronously uploaded to an Object Storage Service (OSS) bucket.
      Note You cannot access the OSS bucket that stores log backup files.
    • You can specify the rules that are used to upload backup log files. These rules ensure that your RDS instance uploads the backup log files to the specified OSS bucket at fast speeds. For more information, see Configure policies to delete binary log files from an ApsaraDB RDS for MySQL instance.
      Note The Basic Edition does not support the upload of log backup files to an OSS bucket.

Modify the backup settings of an RDS instance that uses local SSDs

Your RDS instance automatically performs backups based on the specified backup policy.

  1. In the left-side navigation pane, click Backup and Restoration.
  2. On the Backup and Restoration page, click the Backup Settings tab. On the Backup Settings tab, click Edit.
  3. Configure the following parameters and click OK.
    Backup Settings dialog box - local SSD
    Parameter Description
    Backup Cycle The cycle based on which you want to create a backup. You can select one or more days of the week.
    Note For data security purposes, we recommend that you back up your RDS instance at least twice a week.
    Backup Time The hour at 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 backup files. You can specify a number of days or select long term backup.
    • If you specify a number of days, ApsaraDB RDS deletes the backup files that are stored longer than the specified retention period. If you select the long term backup option, ApsaraDB RDS does not delete backup files. If you want to retain backup files after your RDS instance is released, set the Backup Retention Policy After Release parameter to Latest or All.
    • If the specified retention period does not exceed 730 days, backup files are retained as regular backup files.
    • If the specified retention period exceeds 730 days, the backup files that are stored longer than 730 days are automatically converted into archived backup files. Therefore, you must specify an archived backup retention period. For example, if you select Monthly and then enter 2 in the unit field, ApsaraDB RDS retains the first two archived backup files that are generated per month.Specify an archived backup retention period
    Log Backup The switch that is used to control the log backup feature.
    Notice If you disable this feature, all log backup files are deleted. In addition, you cannot restore the data of your RDS instance to a specific point in time.
    Log Retention Period (Days)
    • The number of days for which you want to retain log backup files. Valid values: 7 to 730. Default value: 7.
    • The log backup retention period must be less than or equal to the data backup retention period.
    Restore Individual Database/Table The feature that is used to restore individual databases and tables. After you enable this feature, ApsaraDB RDS changes the existing backup file format to support this feature. By default, this feature is enabled. You cannot disable this feature. For more information, see Restore individual databases and tables for an ApsaraDB RDS for MySQL instance.
    Backup Retention Policy After Release The policy that is used to retain data backup files after your RDS instance is released. Valid values: None, Latest, and All.

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

    Note
    • This policy allows you to permanently retain backup files. The retention is free of charge.
    • This policy is supported for both pay-as-you-go and subscription RDS instances.

Modify the backup settings of an RDS instance that uses standard or enhanced SSDs

Your RDS instance automatically performs backups based on the specified backup policy.

  1. In the left-side navigation pane, click Backup and Restoration.
  2. On the Backup and Restoration page, click the Backup Settings tab. On the Backup Settings tab, click Edit.
  3. Configure the following parameters and click OK.
    Backup Settings dialog box - standard or enhanced SSD
    Note If your RDS instance runs the Basic Edition, you can configure only the Backup Cycle and Backup Time parameters.
    Parameter Description
    Snapshot Backup Period The cycle based on which you want to create a backup. You can select one or more days of the week.
    Note For data security purposes, we recommend that you back up your RDS instance at least twice a week.
    Snapshot Backup Start Time The hour at which you want to create a backup. We recommend that you select an off-peak hour.

    If you want to increase the snapshot backup frequency, select Increase Snapshot Frequency and specify a snapshot backup frequency.

    Snapshot Backup Retention The number of days for which you want to retain snapshot backup files. The default maximum snapshot backup retention period is 730 days. However, if you select Increase Snapshot Frequency, the maximum snapshot backup retention period is shortened based on the specified snapshot backup frequency. You can calculate the maximum snapshot backup retention period based on the following formula:

    Maximum snapshot backup retention period = (900/Number of backups created per day/Number of backups created per week × 7). The result is rounded down to the previous integer.

    For example, if you select two days of the week and then select the Every 30 Minutes frequency, the maximum snapshot backup retention period is 65 days based on the following calculation: Maximum snapshot backup retention period = ⌊900/(24 × 2 )/2 × 7⌋ = 65 (days).

    Log Backup The switch that is used to control the log backup feature.
    Notice If you disable this feature, all log backup files are deleted. In addition, you cannot restore the data of your RDS instance to a specific point in time.
    Log Retention Period (Days)
    • The number of days for which you want to retain log backup files. Valid values: 7 to 730. Default value: 7.
    • The log backup retention period must be less than or equal to the data backup retention period.
    Note If your RDS instance runs MySQL 5.7 on RDS Basic Edition with standard SSDs, the log retention period is seven days and cannot be changed.
    Single-digit Second Backup The switch that is used to control the single-digit second backup feature. This feature allows you to take snapshots in seconds. ApsaraDB RDS retains up to 10 snapshot backup files. If the number of retained snapshot backup files reaches 10, the next snapshot backup fails. Therefore, we recommend that you set the Snapshot Backup Retention parameter to a value that is less than or equal to 10.
    Note This feature is supported only when your RDS instance uses enhanced SSDs.

Back up an RDS instance

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

Note Physical and snapshot backup files can be directly restored to a new RDS instance. Logical backup files cannot be directly restored.
  1. In the upper-right corner of the page, click Back Up Instance.
  2. Specify a backup mode and a backup policy. Then, click OK.
    Physical Backup mode
    Note If you select the Logical Backup mode and then the Database/Table Backup policy, you must also select databases from the left-side list and click the right arrow (>) to move the selected databases to the right-side list. If no databases are created, you must create databases before you back up your RDS instance. For more information, see Create accounts and databases for an ApsaraDB RDS for MySQL instance.
    Logical Backup - Database/Table Backup
  3. In the upper-right corner of the page, click the Task Progress icon to view the progress of the created backup task. Wait until the backup task is complete.
    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 generated backup file. Some RDS instances do not support the download of backup files. For more information, see Download the data and log backup files of an ApsaraDB RDS for MySQL instance.
    • The retention period of the backup files that are generated from manual backups is specified by the Data Backup Retention parameter. For more information, see the parameters that are described in Step 6 of the "Modify the backup settings of an RDS instance that uses local SSDs" section in this topic.
    Download a backup file

FAQ

  1. When a backup is in progress, does the performance of my RDS instance decrease?
    • If your RDS instance runs the High-availability or Enterprise Edition, it has a secondary RDS instance as a standby. All backups are performed on the secondary RDS instance. In this case, the performance of your RDS instance does not decrease during a backup.
    • If your RDS instance runs the Basic Edition, it stands alone without a standby. All backups are performed on your RDS instance. In this case, the performance of your RDS instance decreases during a backup.
  2. How do I query data from backup files at fast speeds?

    If you have full logical backup files, you can use Database Backup (DBS) to query data from these files. This way, you do not need to restore the data of these files. This accelerates queries. For more information, see Overview.

  3. Can I disable the data backup feature of my RDS instance?

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

  4. Can I disable the log backup feature of my RDS instance?

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

  5. Why did my backup task fail?

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

  6. My RDS instance has a small amount of data. However, the size of the generated snapshot is large. Why?

    When ApsaraDB RDS takes a snapshot of your RDS instance, it eliminates empty blocks. This allows the size of the snapshot to be smaller than the required disk space. Each block is 2 MB in size. However, if write operations are scattered, a large number of blocks are not full. For example, if 3 MB of data is written across two, three, or four blocks, none of these blocks is full. When ApsaraDB RDS calculates the size of the snapshot, it counts in all the non-empty blocks to which data is written. As a result, the disk space that is occupied by the snapshot is greater than the actual size of the snapshot.

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

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

    Backup for Deleted Instances page

References

Related API operations

Operation Description
Create backup set Creates a backup for an ApsaraDB RDS instance.
Query backup sets Queries the backup files of an ApsaraDB RDS instance.
Query backup settings Queries the backup settings of an ApsaraDB RDS instance.
Modify backup settings Modifies the backup settings of an ApsaraDB RDS instance.
Delete backup sets Deletes the data backup files of an ApsaraDB RDS instance.
Query backup tasks Queries the backup tasks of an ApsaraDB RDS instance.
Query log backup files Queries the log backup files of an ApsaraDB RDS instance.