All Products
Search
Document Center

Database Backup:Use the emergency recovery feature for an ApsaraDB RDS for MySQL instance

Last Updated:May 31, 2023

ApsaraDB RDS for MySQL provides the emergency recovery feature that is developed based on copy data management (CDM). This feature allows you to use the backup data of an ApsaraDB RDS for MySQL instance to quickly create an emergency RDS instance. The emergency RDS instance can be used in scenarios such as recovery drills, development and testing, query and analysis, and emergency disaster recovery. This topic describes how to enable and use the emergency recovery feature.

Note

Prerequisites

  • The original RDS instance meets the following requirements:

    • The RDS instance runs MySQL 8.0, MySQL 5.7, MySQL 5.6, or MySQL 5.5.

    • The RDS instance runs RDS High-availability Edition.

    • The RDS instance uses local disks.

    • The RDS instance resides in one of the following regions and zone: China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Chengdu), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Hong Kong), Singapore, Australia (Sydney), Malaysia (Kuala Lumpur), Indonesia (Jakarta), Japan (Tokyo), India (Mumbai), Germany (Frankfurt), US (Silicon Valley), US (Virginia), and China East 1 Finance.

  • Note

    You can go to the Basic Information page of your RDS instance to obtain the preceding information.

  • At least one physical backup is complete for the RDS instance in the ApsaraDB RDS console. For more information, see Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance or Manually back up an ApsaraDB RDS for MySQL instance.

  • Transparent Data Encryption (TDE) is disabled for the RDS instance. For more information about TDE, see Configure TDE for an ApsaraDB RDS for MySQL instance.

  • PrivateLink is activated.

Feature description

Item

Description

Restoration range

The entire RDS instance is restored.

Point in time for data restoration

  • If the log backup feature is enabled, you can restore data to a point in time within the specified log backup retention period. For more information, see Use the log backup feature.

  • If the log backup feature is disabled, you can restore the data to the point in time when the data is backed up.

Billing rules

The fee of the emergency recovery feature consists of the sandbox storage fee and the sandbox instance fee.

Billable item

Description

Sandbox storage fee

After you enable the sandbox feature, Database Backup (DBS) automatically synchronizes the data that is backed up to the sandbox storage and generates snapshots for the data. DBS charges you for data storage based on the volume of the data that is stored in the sandbox storage. For more information, see DBS sandbox fees.

Sandbox instance fee

After you create a sandbox instance, DBS charges you for sandbox instance resources based on the specifications and duration of the sandbox instance. If you do not create sandbox instances, you are not charged for sandbox instance resources. For more information, see DBS sandbox fees.

Enable the sandbox feature

  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 Crash Recovery tab.

  4. Click Enable DBS Sandbox.

  5. In the Set Sandbox Policy dialog box, configure the following parameters.

    Parameter

    Description

    Sandbox Feature

    Turn on Sandbox Feature.

    Sandbox Data Retention Period

    Specify the number of days for which DBS retains the data that is used to create sandbox instances. Default value: 7. By default, DBS retains data in the last seven days. You can restore data to a point in time within the retention period. The value of 0 specifies that only the latest snapshot is stored.

  6. Click OK.

    The sandbox feature is enabled. If this is the first time you enable this feature, DBS stores the latest full backup set of the RDS instance in sandbox storage and generates snapshots that can be used to create sandbox instances. This process may take 5 to 20 minutes based on the backup set size.

    After the available time range is displayed to the right of the Available Time Range to Recover parameter, you can create sandbox instances.

Create a sandbox instance

  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 Crash Recovery tab.

  4. Click Recover Sandbox Instance. In the dialog box that appears, configure the following parameters.

    Section

    Parameter

    Description

    Sandbox Instance Point in Time

    Sandbox Data Time Range

    The time range in which you can restore the source database. The available time range is from the point in time at which the first snapshot was created in the sandbox storage to the current point in time.

    Note
    • The actual available time range may be shorter.

    • Data can be restored within the time range from the point in time at which the first snapshot was created in sandbox storage to the end time of the latest binary log file. Data may not be restored within the time range from the end time of the latest binary log file to the current time. You can view the point in time when the latest binary log file was generated on the Base Backups > Log Backup tab of the Backup and Restoration page.

    Recovery Method

    • Recovery by Snapshot Point in Time: You can select only the point in time when a snapshot was created. If you use this restoration method, the system takes less time to complete the restoration. This is the recommended value.

    • Recovery by Custom Point in Time: You can select a specific point in time within the log backup retention period. The amount of time required for the restoration to complete varies based on the backup size. For more information about the log backup feature, see Use the log backup feature.

      Note

      You can select Recovery by Custom Point in Time only for an RDS instance that runs RDS High-availability Edition and use the log backup feature. For more information about the log backup feature, see Use the log backup feature.

    Sandbox Instance Configurations

    Specifications

    The specifications of the sandbox instance that you want to create. Valid values:

    • 1 Core, 1 GB Memory

    • 1 Core, 2 GB Memory

    • 2 Cores, 4 GB Memory

    • 2 Cores, 8 GB Memory

    • 4 Cores, 8 GB Memory

    • 4 Cores, 16 GB Memory

    • 8 Cores, 16 GB Memory

    • 8 Cores, 32 GB Memory

    The restoration speed does not vary with the specifications of sandbox instances. However, sandbox instances with higher specifications deliver better performance. For more information, see DBS sandbox fees.

    Region

    The region in which the sandbox instance resides. By default, the value of this parameter is fixed.

    Peer VPC

    The virtual private cloud (VPC) for the sandbox instance.

    If you want to connect to the sandbox instance by using your Elastic Compute Service (ECS) instances, you must set this parameter to the VPC in which the ECS instances reside. For more information about how to create a VPC, see Create and manage a VPC.

    Peer vSwitch

    The vSwitch for the sandbox instance. The sandbox instance can be accessed by using the CIDR block specified for the vSwitch.

    Security Group

    The security group that you want to use. The port 3306 must be enabled for the security group. For more information about how to create a security group, see Create a security group.

    Note

    This parameter is displayed only if you enable the emergency recovery feature for an instance for the first time.

    Database Account Type

    The type of the database account. Valid values:

    • Use Original Database Account: Use the account of the source database.

    • Create Privileged Account: Create a privileged account in the sandbox instance. The privileged account has permissions on all databases in the instance. You must also configure the Database Account and Password parameters. The account of the source database is retained in the sandbox instance.

      Note
      • A privileged account is created only in the current sandbox instance.

      • If the username of the account for the source database is the same as the username of the privileged account, the account of the source database is overwritten by the privileged account in the sandbox instance.

  5. Click OK.

    The system performs a precheck and creates the sandbox instance. When the state of the sandbox instance changes to Sandbox Instance Status, you can connect to the sandbox instance.

    The username and password of the account and all configurations of the sandbox instance are consistent with those of the source database. If you select Create Privileged Account in Step 5, you can also use the privileged account that is created to connect to the sandbox instance.

  6. (Optional). Connect to the sandbox instance.

    Obtain the endpoint of the sandbox instance in the ApsaraDB RDS console and use the endpoint to connect to the sandbox instance from a client. You can also connect to the sandbox instance by using Data Management (DMS) or ECS. For more information, see Use DMS to access sandbox instances and Use ECS to access sandbox instances.

    Note

    The client, such as an ECS instance, that you use to connect to the sandbox instance must be deployed in the same VPC as the sandbox instance.

Correct the online data on the original RDS instance

After the sandbox instance is created, you can use Data Transmission Service (DTS) to migrate data of some or all databases or tables to the original RDS instance to correct the online data of the original RDS instance. For more information, see Migrate data between ApsaraDB RDS for MySQL instances.

Note

When you create a migration task, specify the sandbox instance as the source database and the original RDS instance as the destination database and set the Access Method parameter to Self-managed Database on ECS for the source database and Alibaba Cloud Instance for the destination database.

Disable the sandbox feature

  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 Crash Recovery tab.

  4. Click Set Sandbox Policy. In the dialog box that appears, turn off Sandbox Feature.

  5. In the message that is displayed, click OK.

Related operations

Operation

Operation

CreateSandboxInstance

Creates a sandbox instance.

DescribeSandboxInstances

Queries sandbox instances that are created within an account.

DescribeSandboxRecoveryTime

Queries the recoverable time range of a sandbox instance.

DeleteSandboxInstance

Releases a sandbox instance.