This topic describes how to enable automatic backups for an ApsaraDB RDS for MySQL instance. ApsaraDB RDS for MySQL supports automatic backups and manual backups.

For more information about how to enable automatic backups for an RDS instance that runs a different database engine, see the following topics:

Note The default 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 different region than your RDS instance, see Enable cross-region backups for an ApsaraDB RDS for MySQL instance.

Introduction

You can back up your RDS instance by using one of the following two methods:
  • ApsaraDB RDS: ApsaraDB RDS provides a default backup feature that supports full backups and incremental backups. Full backups are also called data backups, and incremental backups are also called log backups.
  • Database Backup (DBS): DBS provides an advanced backup feature that supports cross-account backups and can complete a backup in single-digit seconds.

Use ApsaraDB RDS to perform automatic backups

ApsaraDB RDS supports automatic data backups and automatic log backups. Data backups cannot be disabled. However, you can change the data backup frequency based on your business requirements.
Table 1. Data backup frequency
Instance configuration Minimum frequency Maximum frequency
  • RDS instances that run the RDS High-availability Edition or Enterprise Edition with local SSDs
  • RDS instances that run the RDS Basic Edition with standard SSDs or enhanced SSDs (ESSDs)
Twice every week Once every day
RDS instances that run the RDS High-availability Edition with standard SSDs or ESSDs Once every 15 minutes (You must enable the Increase Snapshot Frequency feature.)
Precautions
  • Backup policies cannot be configured for read-only RDS instances.
  • Do not execute data definition language (DDL) statements during a backup. 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 the number of tables that are created on your RDS instance exceeds 600,000, your RDS instance cannot be backed up. In this case, we recommend that you shard the databases 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 of an ApsaraDB RDS for MySQL instance.

Procedure

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Backup and Restoration.
  3. On the Backup and Restoration page, click the Backup Settings tab and click Edit.
  4. Configure the following parameters and click OK.
    Note If your RDS instance is equipped with standard SSDs or ESSDs, ApsaraDB RDS takes snapshots to back up the data of your RDS instance.
    Table 2. Data backup settings
    Instance configuration Parameter Description
    All RDS instances Data Backup Retention (Days) The number of days for which you want to retain data backup files. Default value: 7. Valid values:
    • For RDS instances that use standard SSDs or ESSDs: 7 to 730.
      Note
      • If your RDS instance runs MySQL 5.7 on RDS Basic Edition, the data backup retention period is fixed to seven days.
      • If you enable the Single-digit Second Backup feature, the data backup retention period is fixed to seven days.
    • For RDS instances that are equipped with local SSDs: 7 or more. The number of days must be less than 2 to the power of 31.
      • Data backup files that are retained for 730 days or less are regular backup files.
      • Data backup files that are retained for more than 730 days are archived backup files. Archived backup files cost less than regular backup files. For more information, see Backup storage pricing for an ApsaraDB RDS for MySQL instance.
      Note If the data backup retention period exceeds 730 days or if you select Long-term Retention, the data backup files that are retained for more 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 enter 2 in the unit field, ApsaraDB RDS retains the first two archived backup files that are generated each month.
    Backup Cycle The cycle based on which you want to create a data backup. You must select at least two days of the week.
    Backup Time The hour at which you want to create a data backup. For example, you can select the 05:00-06:00 period. We recommend that you select an off-peak hour.
    RDS instances that are equipped with local SSDs Data Backup Retention Policy After Release Specifies whether to retain a specific number of data backup files after your RDS instance is released. Select Latest or All.
    Note
    • This policy is used to permanently retain data backup files. You are not charged for the storage of the retained data backup files.
    • This policy is supported for both pay-as-you-go RDS instances and subscription RDS instances.
    • After your RDS instance is released, you can go to the Backup for Deleted Instances page to download the data backup files of your RDS instance. Then, you can use the data backup files to restore your RDS instance.
    Restore Individual Database/Table Specifies whether to support the restoration of individual databases and tables. For more information, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance. The Restore Individual Database/Table feature is automatically enabled and cannot be disabled.
    Note
    RDS instances that are equipped with standard SSDs or ESSDs Increase Snapshot Frequency The frequency at which you want to create a snapshot backup. You can increase the frequency to up to once every 15 minutes.
    Note
    • The Increase Snapshot Frequency feature is supported only for RDS instances that run the RDS High-availability Edition with standard SSDs or ESSDs.
    • You cannot enable both the Increase Snapshot Frequency feature and the Single-digit Second Backup feature.
    • After the Increase Snapshot Frequency feature is enabled, the maximum backup retention period decreases.
    Single-digit Second Backup Allows ApsaraDB RDS to complete a backup within seconds.
    Note
    • The Single-digit Second Backup feature is supported only for RDS instances that run the RDS High-availability Edition with ESSDs.
    • You cannot enable both the Increase Snapshot Frequency feature and the Single-digit Second Backup feature.
    • After the Single-digit Second Backup feature is enabled, the backup retention period is fixed to seven days.
    • After the Single-digit Second Backup feature is enabled, a maximum of 10 backup files that are generated from automatic backups and manual backups in total can be retained. If the total number of backup files reaches 10, you cannot perform more backups.
    Table 3. Log backup settings
    Parameter Description
    Log Backup Specifies whether to enable the log backup feature. After this feature is enabled, you can restore the data of your RDS instance to a specific point in time. By default, this feature is enabled.
    Note This feature cannot be disabled for RDS instances that run MySQL 5.7 on RDS Basic Edition.
    Retention Period
    • The log backup retention period ranges from 7 days to 730 days. By default, the log backup retention period spans 7 days.
    • The log backup retention period must be less than or equal to the data backup retention period.
    Note The log backup retention period is fixed to 7 days for RDS instances that run MySQL 5.7 on RDS Basic Edition.

Use DBS to perform automatic backups

  1. Create a backup schedule. Make sure that you select the logical backup method.
  2. Configure the backup schedule that you created.
For more information, see Back up an ApsaraDB RDS for MySQL, PolarDB for MySQL, or self-managed MySQL database.

FAQ

  1. When a backup is in progress, does the performance of my RDS instance decrease?
    • Backup operations of an ApsaraDB RDS instance on RDS High-availability Edition or Enterprise Edition are performed on the secondary instance. Therefore, they do not occupy CPU resources of the primary instance or affect its performance.
      Note In rare cases when the secondary instance is unavailable, backups are performed on the primary instance.
    • If an ApsaraDB RDS instance runs the RDS Basic Edition, it stands alone without a standby. All backups are performed on the instance. In this case, the performance of the 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 DBS to query data from these files. This way, you do not need to restore the data of these files. For more information, see Backup set query overview.

  3. Can I disable data backups for my RDS instance?

    No, you cannot disable data backups for 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.

  4. Can I disable log backups for my RDS instance?

    Yes, if your RDS instance does not run MySQL 5.7 on RDS Basic Edition, you can disable log backups for your RDS instance in the ApsaraDB RDS console.

  5. Why did my backup task fail?

    When the backup task was in progress, you may have executed time-consuming DDL statements or UPDATE statements. These statements trigger locks on tables. Your backup task may have failed as a result of the locks.

  6. Why is the size of a snapshot backup file significantly larger than the amount of data on my RDS instance?
    If your RDS instance uses standard or enhanced SSDs, ApsaraDB RDS takes snapshots to back up your RDS instance. The size of a snapshot backup file may be significantly larger than the amount of data. Therefore, the free quota for backup storage that is allocated to an RDS instance that uses standard or enhanced SSDs is four times the free quota for backup storage that is allocated to an RDS instance that uses local SSDs. For more information, see Backup storage pricing for an ApsaraDB RDS for MySQL instance.
    Note When ApsaraDB RDS calculates the size of a snapshot backup file, it 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, ApsaraDB RDS 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.

References

Related operations