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

For more information about how to enable the automatic backup feature 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 region that is different from the region of your RDS instance, see Enable cross-region backups for an ApsaraDB RDS for MySQL instance.

Introduction to backups

You can back up your RDS instance by using one of the following 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. This feature supports cross-account backups and allows DBS to create a backup within seconds.
For more information about the differences between the default backup feature of ApsaraDB RDS and the advanced backup feature of DBS, see ApsaraDB RDS-generated backups and DBS-generated backups.

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 RDS High-availability Edition or RDS Enterprise Edition with local SSDs
  • RDS instances that run RDS Basic Edition with standard SSDs or enhanced SSDs (ESSDs)
Twice every week Once every day
RDS instances that run 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 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, backups cannot be created. 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 the individual databases and tables of an ApsaraDB RDS for MySQL instance.

Procedure

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the left-side navigation pane, click Backup and Restoration.
  3. On the Backup and Restoration page, click the Backup Settings tab. In the Data Backup Settings section of the tab that appears, click Edit.
  4. Configure the following parameters and click OK.
    Note If your RDS instance is equipped with standard SSDs or ESSDs, ApsaraDB RDS creates snapshots to back up the data of the RDS instance.
    Table 2. Data backup settings
    Instance configuration Parameter Description
    RDS instances with all types of configurations Data Backup Retention (Days)/Retention Period The number of days for which data backup files are retained. Default value: 7. Valid values:
    • For RDS instances that are equipped with standard SSDs or ESSDs: 7 to 730.
      Note
      • If your RDS instance runs MySQL 5.7 on RDS Basic Edition, the value is fixed as 7 and cannot be changed.
      • If you enable the Single-digit Second Backup feature, the valid value of this parameter ranges from 7 to 730.
    • 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 considered regular backup files.
      • Data backup files that are retained for more than 730 days are converted into archived backup files. The cost of archived backup files is less than the cost of regular backup files. For more information, see Backup storage pricing of an ApsaraDB RDS for MySQL instance.
      Note If you set this parameter to a value greater than 730 or 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 configure the Archived Backup Retention parameter. 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 data backups are created. You must select at least two days of the week.
    Backup Time The hour at which a data backup is created. 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 data backup files that are retained.
    • This policy is supported for 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 tab to download the data backup files of your RDS instance. Then, you can use the data backup files to restore the data of 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
    Restore Speed The speed at which an individual database or table is restored. Valid values:
    • Standard: Databases and tables are restored at a regular speed.
    • Fast: Databases and tables are restored at a high speed. Fast restoration provides a restoration speed that is 50% to 95% faster than standard restoration. Fast restoration is in public review and is provided free of charge.

    For more information about the restoration of databases and tables, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.

    Note The fast restoration of databases and tables is supported only in the China (Zhangjiakou) and China (Hohhot) regions.
    RDS instances that are equipped with standard SSDs or ESSDs Increase Snapshot Frequency The frequency at which snapshot backups are created. This feature enables you to configure a shorter interval to create snapshots by using the Single-digit Second Backup feature, which increases the frequency of the snapshots. You can increase the frequency to up to once every 15 minutes.
    The snapshot retention policies vary based on the value of this parameter.
    • A value at the minute granularity: All snapshots that are completed within 1 hour are retained. For snapshots that are retained for more than 1 hour, ApsaraDB RDS deletes the snapshots except for the first snapshot after the hour. For snapshots that are retained for more than 24 hours, ApsaraDB RDS deletes the snapshots except for the first snapshot after 00:00 every day.
    • A value at the hour granularity: All snapshots that are completed within 24 hours are retained. For snapshots that are retained for more than 24 hours, ApsaraDB RDS deletes the snapshots except for the first snapshot after 00:00 every day.
    Note
    • The Increase Snapshot Frequency feature is supported only for RDS instances that run the RDS High-availability Edition with standard SSDs or ESSDs.
    • If you want to enable this feature, you must enable the Single-digit Second Backup feature. If the Single-digit Second Backup feature is disabled, ApsaraDB RDS automatically enables the Single-digit Second Backup feature when you enable the Increase Snapshot Frequency feature.
    Single-digit Second Backup Allows ApsaraDB RDS to create a backup within seconds.
    Note The Single-digit Second Backup feature is supported only for RDS instances that run RDS High-availability Edition with ESSDs.
    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 specified point in time. This feature is enabled by default.
    Note You cannot disable this feature for RDS instances that run MySQL 5.7 on RDS Basic Edition.
    Log Retention Period (Days)
    • The valid value ranges from 7 to 730. The default value is 7.
    • The value of this parameter must be less than or equal to the value of the Data Backup Retention (Days) parameter.
    Note The value is fixed to 7 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 instance by using logical backup.

FAQ

  1. When a backup is in progress, does the performance of my RDS instance decrease?
    • Backup operations of an ApsaraDB RDS instance on 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 Overview.

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

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

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

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

  5. Why did my backup task fail?

    A possible cause is that you executed time-consuming DDL statements or UPDATE statements when your backup task was in progress. These statements triggered locks on tables, and your backup task 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