This topic describes how to enable automatic backups for an ApsaraDB RDS for MySQL instance. This topic also describes how to manually back up an ApsaraDB RDS for MySQL instance.

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

Note This topic describes the default backup feature. This feature 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 Back up an ApsaraDB RDS for MySQL instance across regions.

Precautions

  • Read-only RDS instances do not support backup settings.
  • 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.

Enable automatic backups for your RDS instance

Automatic backups are categorized as automatic data backups and automatic log backups. The data backup feature cannot be disabled. However, you can change the data backup frequency.
Table 1. Data backup frequency
Instance configuration Minimum frequency Maximum frequency
  • RDS instances that run the RDS High-availability or Enterprise Edition with local solid-state drives (SSDs)
  • RDS instances that run the RDS Basic Edition with standard or enhanced SSDs
Twice every week Once every day
RDS instances that run the RDS High-availability Edition with standard or enhanced SSDs Once every 15 minutes (You must enable the Increase Snapshot Frequency feature.)

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. On the Backup Settings tab, click Edit.
  4. Configure the following parameters and click OK.
    Note If your RDS instance uses standard or enhanced SSDs, 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 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.
    Retention Period The number of days for which you want to retain the generated data backup files. Default value: 7. Valid values:
    • For RDS instances that use standard or enhanced SSDs: 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 use local SSDs: 7 or more. The number of days must be less than 2 to the power of 31.
      Note If the data backup retention period exceeds 730 days or if you select Long-term Retention, the data backup files that have been stored for 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 each month.
    RDS instances that use local SSDs Long-term Retention Specifies to retain the generated data backup files before your RDS instance is released.
    Backup Retention Policy After Release Specifies 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 and subscription RDS instances.
    • After your RDS instance is released, you can go to the Backup for Deleted Instances page and 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 you can restore individual databases and tables of your RDS instance. For more information, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance. By default, this feature is enabled. You cannot disable this feature.
    Note
    RDS instances that use standard or enhanced SSDs 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 or enhanced SSDs.
    • 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 1 second.
    Note
    • The Single-digit Second Backup feature is supported only for RDS instances that run the RDS High-availability Edition with enhanced SSDs.
    • 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 automatic and manual backup files in total can be retained. If the total number of backup files reaches 10, you cannot manually create backups.
    Table 3. Log backup settings
    Parameter Description
    Log Backup The switch that is used to control the log backup feature. 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.

Manually back up your RDS instance

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the upper-right corner of the page, click Back Up Instance.
  3. Back up all or specific databases of your RDS instance. For more information, see the following table.
    Note If you want to perform incremental backups, you need only to enable the log backup feature.
    Instance configuration Backup on all databases Backup on specific databases
    RDS instances that use local SSDs Use one of the following methods:
    • Select Physical Backup from the Select Backup Mode drop-down list. The speeds of physical backup and restoration are faster than the speeds of logical backup and restoration.
    • Select Logical Backup from the Select Backup Mode drop-down list. Then, set the Backup Policy parameter to Instance Backup.
    Select Logical Backup from the Select Backup Mode drop-down list. Then, set the Backup Policy parameter to Database/Table Backup.
    RDS instances that use standard or enhanced SSDs Set the Backup Policy parameter to Snapshot Backup. Not supported
    Note Physical backup files and snapshot backup files can be directly restored to a new RDS instance. Logical backup files cannot be directly restored.
  4. 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

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 Database Backup (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 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 at least twice a week. The data backup retention period must span at least seven days.

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

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

  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?
    Cloud Disk instances are backed up by using snapshots. The size of a snapshot backup may be much larger than the size of the data. Therefore, the free backup quota of a cloud disk instance is four times that of an instance with local disks.
    Note When the snapshot backup size is calculated, the size of all non-empty blocks is calculated. If the writing time is scattered (for example, 3MB of data may occupy two, three, or even four blocks), this causes many non-empty blocks, and therefore leads to a large number of snapshot backups.

References

Related operations

Operation Description
Create data backup Creates a backup task for an ApsaraDB RDS instance.
Query backup sets Queries the data 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.