All Products
Search
Document Center

ApsaraDB RDS:Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance

最終更新日:May 23, 2023

Automatic backup and manual backup are supported for ApsaraDB RDS for MySQL and serverless ApsaraDB RDS for MySQL instances.

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. If you want to store backup files to a region that is different from the region of your RDS instance, follow the instructions provided in Use the cross-region backup feature of 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 data backups and incremental log backups.

  • DBS: Database Backup (DBS) provides the logical backup feature. The logical backup supports advanced capabilities such as cross-account backup and quick query.

For more information about the differences between the default backup feature of ApsaraDB RDS and the logical backup feature of DBS, see Differences between default RDS backups and advanced DBS 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 category

Minimum frequency

Maximum frequency

  • RDS instances that run RDS High-availability Edition or RDS Enterprise Edition with local disks

  • RDS instances that run RDS Basic Edition with cloud disks

Twice every week

Once every day.

RDS instances that run RDS High-availability Edition or RDS Cluster Edition with cloud disks

Once every 15 minutes. You must enable the Increase Snapshot Frequency feature.

Prerequisites

If this is the first time that you use the backup feature of ApsaraDB RDS, you must create the AliyunServiceRoleForDBS service-linked role for Database Backup (DBS) by using your Alibaba Cloud account. For more information, see How do I create a service-linked role for DBS.

Usage notes

  • Backup policies cannot be configured for read-only RDS instances.

  • Do not execute DDL statements during a backup operation. If DDL statements are executed during a backup operation, the relevant tables are locked and the backup operation fails.

  • We recommend that you back up data during off-peak hours.

  • If the number of tables that are created on your RDS instance exceeds 600,000, you cannot back up the data. 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. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane, click Backup and Restoration.

  3. On the Backup and Restoration page, click the Backup Strategy tab.

  4. In the Basic Backup section, click Edit. Configure the following parameters and click OK.

    Note

    If your RDS instance uses cloud disks, the system creates snapshots to back up the data of the RDS instance.

    Table 2. Data backup settings

    Instance category

    Parameter

    Description

    All RDS instances

    Full Backup Retention Period (Days)

    The number of days for which backup files are retained. Default value: 7. Valid values:

    • For RDS instances that use cloud disks: 7 to 730.

      Note
      • If your RDS instance runs MySQL 5.7 on RDS Basic Edition, the value is fixed as 7.

      • If you enable the single-digit second backup feature, the value of this parameter ranges from 7 to 730.

    • For RDS instances that use local disks: 7 or more. The value 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, you must specify the number of archived backup files to retain. For example, if you select Monthly and enter 2 in the unit field, the system retains the first two archived backup files that are generated each month.

    Full Backup Cycle

    The cycle based on which data backups are created. You must select at least two days of the week.

    Start At

    The time at which a data backup starts. For example, you can select 08:00. We recommend that you select an off-peak hour.

    RDS instances that use local disks

    Database/Table Restoration

    Specifies whether to enable the restoration feature for individual databases and tables. For more information, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance The restoration feature for individual databases and tables is automatically enabled and cannot be disabled.

    Note

    Fast Restoration

    Specifies whether to enable the fast restoration feature for individual databases and tables. If you enable the fast restoration feature for individual databases and tables, the data is restored at a fast speed. If you disable the fast restoration feature, the data is restored at a standard speed.

    • Standard: Data is restored at a standard speed.

    • Fast: Data is restored at a speed that is 50% to 95% faster than standard restoration.

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

    Note
    • If you enable the fast restoration feature for individual databases and tables, you must also configure the CDM Billing Method and CDM Retention Period parameters.

    • The fast restoration feature for individual databases and tables is not supported in some Alibaba Cloud regions.

    Retain Backup Files after Instance Release

    Specifies whether to retain backup files after the RDS instance is released.

    Note

    RDS instances that use cloud disks

    Backup within Seconds

    Specifies whether to enable the single-digit second backup feature. If the feature is enabled, a snapshot backup can be completed within a few seconds.

    Note

    This feature is supported for RDS High-availability Edition with enhanced SSDs (ESSDs) and RDS Cluster Edition.

    Increase Snapshot Frequency

    The frequency at which snapshot backups are created. You can 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 generated 1 hour ago, the system deletes the snapshots except for the first snapshot after the hour. For snapshots that are generated 24 hours ago, the system deletes the snapshots except for the first snapshot after 00:00 every day.

    • A backup frequency at the hour granularity: All snapshots that are completed within 24 hours are retained. For snapshots that are generated 24 hours ago, the system deletes the snapshots except for the first snapshot after 00:00 every day.

    Note
    • This feature is supported for RDS High-availability Edition with cloud disks and RDS Cluster Edition.

    • 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, the system automatically enables the single-digit second backup feature when you enable this feature.

    • This feature is supported only for RDS instances that run RDS High-availability Edition with cloud disks.

    • You cannot enable the Increase Snapshot Frequency feature and the Single-digit Second Backup feature at the same time.

    • After the Increase Snapshot Frequency feature is enabled, the maximum backup retention period decreases.

    Fast Database/Table Restoration

    Specifies whether to enable the fast restoration feature for individual databases and tables. Fast restoration provides a restoration speed that is 50% to 95% faster than standard restoration.

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

    Note

    The fast restoration feature for individual databases and tables is not supported in some Alibaba Cloud regions.

    Table 3. Log backup settings

    Parameter

    Description

    Log Backup

    Specifies whether to enable the log backup feature. After the feature is enabled, you can restore the data of your RDS instance to a point in time. This feature is enabled by default.

    Log Backup Retention Period (Days)

    • 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

    The value is fixed as 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 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?

    RDS editionDescription
    RDS High-availability Edition and RDS Enterprise EditionBackup operations are performed on the secondary RDS instance. In this case, the operations do not occupy the CPU resources or affect the performance of the primary RDS instance.
    Note In rare cases when the secondary RDS instance is unavailable, backup operations are performed on the primary RDS instance.
    RDS Cluster EditionBackup operations are performed on the secondary node. In this case, the operations do not occupy the CPU resources or affect the performance of the primary node.
    Note In rare cases when the secondary node is unavailable, backup operations are performed on the primary node.
    RDS Basic EditionIf an RDS instance runs RDS Basic Edition, the instance stands alone. All backup operations are performed on the RDS instance. In this case, the performance of the 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 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 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. You can disable the log backup feature for your RDS instance in the ApsaraDB RDS console.

  5. Why does 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?

    The size of backup files may not equal the amount of data on your RDS instance. If your RDS instance uses cloud disks, the system creates snapshots to back up your RDS instance. The size of a snapshot backup file may be significantly larger than the amount of data. The free backup quota for an RDS instance that uses cloud disks is four times the free backup quota for an RDS instance that uses local disks.

    Note

    When the system calculates the size of a snapshot backup file, the system counts in all non-empty blocks. 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, the system 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

Category

Operation

Description

ApsaraDB RDS

ModifyBackupPolicy

Modifies the backup settings of an instance.

DescribeBackupPolicy

Queries the backup settings of an instance.

DescribeBackups

Queries the backup sets of an instance.

DescribeBackupTasks

Queries the backup tasks of an instance.

DBS

CreateBackupPlan

Creates a backup plan.

ConfigureBackupPlan

Configures a backup plan.