This topic describes how to back up an ApsaraDB RDS MySQL instance. ApsaraDB for RDS supports both automatic and manual backup. If the data of your RDS instance is lost or damaged, you can restore it by using a data backup file or binary log file.

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 data backup files and binary log files to the region where your RDS instance resides. You can also store data backup files and binary log files to a different region. For more information, see Back up data across regions.

Billing

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

Note

Precautions

  • Do not perform data definition language (DDL) operations during a backup. If you perform DDL operations during a backup, the operations may trigger table locks and cause the backup to fail.
  • 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 take a long time.
  • Data backup files and binary log files are only retained for a specified period of time. We recommend that you download the files you need before the retention period elapses.

Overview of data and log backups

Data backup Log backup
  • 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 SSDs or enhanced SSDs (ESSDs) (in the High-availability Edition):

    Support backups created from snapshots. These snapshots can be used to restore data to a new RDS instance. You cannot download these snapshots.

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

    Support backups created from snapshots. These snapshots can be used to restore data to a new RDS instance. You cannot download these snapshots.

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

Configure a backup policy for the automatic backup of your RDS instance

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

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the page, select the region where the target RDS instance resides.Select a region
  3. Find the target RDS instance and click its ID. The Basic Information page appears.
  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.
  6. In the Backup Settings dialog box, configure the following parameters and click OK. The following table describes the parameters.
    Table 1. Configuration parameters for a backup policy
    Parameter Description
    Data Retention Period Enter the number of days for which you want to retain data backup files. The data retention period can range from 7 days to 730 days. The default period is 7 days.
    Note In the Basic Edition with MySQL 5.7 and standard SSDs, data backup files can only be retained for seven days.
    Backup Cycle Select one or more days on which you want to create backups.
    Note For data security purposes, we recommend that you back up your RDS instance at least twice a week.
    Backup Time Select an hour at which you want to create a backup. We recommend that you select an off-peak hour.
    Log Backup Select Enable or Disable.
    Notice If you disable log backup, all binary log files are deleted and you cannot use point-in-time recovery (PITR).
    Log Retention Period
    • Enter the number of days for which you want to retain binary log files. The log retention period can range from 7 days to 730 days and must be shorter than or equal to the data retention period.
    • The default period is 7 days.
    Note In the Basic Edition with MySQL 5.7 and standard SSDs, binary log files can only be retained for seven days.
    Restore Individual Database/Table This function is enabled by default and cannot be disabled. It restores accidentally deleted individual databases or tables by using backup sets.
    Note This function is only supported for the High-availability Edition with MySQL 5.6 and the High-availability Edition with MySQL 5.7 and local SSDs. For more information, see Restore individual databases or tables for an RDS MySQL instance.

Manually back up your RDS instance

This example uses the High-availability Edition with MySQL 5.7 and local SSDs as an example.

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the page, select the region where the target RDS instance resides.Select a region
  3. Find the target RDS instance and click its ID. The Basic Information page appears.
  4. In the upper-right corner of the page, click Back Up Instance.
  5. Select a backup method and click OK.Physical Backup
    Note If you select Logical Backup > Single-Database Backup, you must also select the databases you want to back up from the list on the left and click > to add them to the list on the right. If no databases are available, you must create some. For more information, see Create accounts and databases for an RDS MySQL instance.
    Logical backup for individual databases
  6. In the upper-right corner of the page, click Task Progress to view the status of the backup task.View Task Progress
    Note After the backup task is complete, go to the Backup and Restoration page to download the data backup file. Some RDS instances do not support the download of data backup files. For more information, see Download the data backup files and log backup files of an RDS for MySQL instance.Download backup

FAQ

  1. Can I disable data backup for my ApsaraDB RDS MySQL instance?

    No, you cannot disable data backup for your ApsaraDB RDS MySQL instance. The data backup function must be enabled. However, you can reduce the backup frequency to as low as twice a week. The data retention period can range from 7 days to 730 days.

  2. Can I disable log backup for my ApsaraDB RDS MySQL instance?

    Yes, you can disable log backup for your ApsaraDB RDS MySQL instance if you are not using the Basic Edition.

  3. Why did my backup task fail?

    You may have performed DDL operations during the backup task. DDL operations trigger locks on tables. The backup task may have failed as a result of the table locks.

References

Related operations

Operation Description
CreateBackup Creates a backup for an ApsaraDB RDS MySQL instance.
DescribeBackups Queries the backup sets created for an ApsaraDB RDS MySQL instance.
DescribeBackupPolicy Queries the backup settings of an ApsaraDB RDS MySQL instance.
ModifyBackupPolicy Modifies the backup settings of an ApsaraDB RDS MySQL instance.
DeleteBackup Deletes one or more data backup files from an ApsaraDB RDS MySQL instance.
DescribeBackupTasks Queries the backup tasks created for an ApsaraDB RDS MySQL instance.
DescribeBinlogFiles Used to view binlogs of an RDS instance.