All Products
Search
Document Center

Database Backup:Use the cloud disaster recovery feature for a self-managed MySQL database

Last Updated:Aug 15, 2024

Database Backup (DBS) provides the cloud disaster recovery feature for self-managed MySQL databases based on copy data management (CDM). This feature allows you to use backup data to quickly create a temporary ApsaraDB RDS for MySQL instance that is used as a disaster recovery instance. This feature can be used in scenarios such as data backup to the cloud, disaster recovery in the cloud, recovery drills, R&D and testing, and queries and analysis.

Note

Prerequisites

A self-managed MySQL database that runs MySQL 5.7 or 8.0 is created.

Billing

You are charged for the billable items that are described in the following table.

Billable item

Description

Sandbox storage

After you enable the DBS sandbox feature for a database instance, sandbox storage is allocated for the database instance. DBS automatically synchronizes the data of the database instance to the sandbox storage and generates sandbox snapshots for the data. DBS charges you for sandbox storage based on the size of data that is stored in the sandbox storage. For more information, see the Sandbox storage fees section of the "DBS sandbox fees" topic.

Temporary ApsaraDB RDS for MySQL instance

Data is restored to a new pay-as-you-go ApsaraDB RDS for MySQL instance that is used as a temporary sandbox instance. Therefore, you are charged for the creation of the ApsaraDB RDS for MySQL instance. The actual fees of an ApsaraDB RDS for MySQL instance prevail.

Note

Step 1: Create a backup schedule

Go to the buy page of DBS to create a backup schedule. For more information, see Create a backup schedule.

Note

On the buy page of DBS, select MySQL as the data source type and select Physical Backup as the backup method.

Step 2: Configure the backup schedule

For more information, see Back up MySQL databases.

Step 3: Configure a disaster recovery policy

To quickly restore data to a temporary ApsaraDB RDS for MySQL instance that is used as a disaster recovery instance, you must enable the sandbox feature and configure a sandbox policy. To do so, perform the following steps:

  1. Log on to the Database Backup (DBS) console.

  2. In the left-side navigation pane, click Backup Schedules. In the top navigation bar, select a region.

  3. On the Backup Schedules page, click Manage in the Actions column corresponding to a backup schedule.
  4. On the Configure Task page, click Set Sandbox Feature in the Sandbox Information section.

    image.png

  5. In the Set Sandbox Policy dialog box, turn on Sandbox Feature and configure the Sandbox Data Retention Period parameter.

    image.png

    Parameter

    Description

    Sandbox Feature

    Specifies whether to enable the sandbox feature. In this example, Sandbox Feature is turned on.

    Sandbox Data Retention Period

    The number of days for which DBS retains the sandbox data such as sandbox snapshots. By default, the sandbox data is retained for seven days. Take note of the following items:

    • Your sandbox snapshots can be used after the sandbox snapshots are created. The system automatically deletes the snapshots after the retention period expires. The system deletes only incremental snapshots. Incremental snapshots refer to the changes to the previous snapshot.

    • A longer retention period indicates that more storage resources are occupied and storage costs are higher.

    • If you want to retain only the latest snapshot, set this parameter to 0.

  6. Click OK.

    After you enable the sandbox feature, the value of the Sandbox instance time range parameter changes to Data preparing. If you enable the sandbox feature for a backup schedule for the first time, DBS stores the latest full backup set to the sandbox storage and generates a snapshot that can be used to create sandbox instances. DBS requires a specific period of time to copy data. The period of time may be 5 to 20 minutes based on the size of the backup data.

    After a specific time range is displayed as the value of the Sandbox instance time range parameter, you can create a temporary ApsaraDB RDS for MySQL instance and restore data to the temporary ApsaraDB RDS for MySQL instance.

    image.png

    The following table describes the values of the Sandbox instance time range parameter.

    Sandbox state

    Description

    Sandbox feature disabled

    The value of the Sandbox instance time range parameter is Unopened.

    Preparation after you enable the sandbox feature

    The value of the Sandbox instance time range parameter changes to Data preparing.

    Preparation completed

    The value of the Sandbox instance time range parameter changes to the time range in which available backup sets are created.

    Note

    The time range is from the start time of the earliest backup to the end time of the latest backup.

Step 4: Restore data to a temporary ApsaraDB RDS for MySQL instance

Perform the following steps to create a temporary ApsaraDB RDS for MySQL instance. This way, if your self-managed MySQL database encounters disasters, you can quickly restore the database data to the temporary ApsaraDB RDS for MySQL instance.

Note
  • Read and write operations performed on the temporary ApsaraDB RDS for MySQL instance do not affect the source self-managed MySQL database.

  • You can use an ApsaraDB RDS for MySQL instance to which data has been restored as a disaster recovery instance. You can manage the lifecycle of the instance by yourself. DBS will not release your ApsaraDB RDS for MySQL instance.

  1. Log on to the Database Backup (DBS) console.

  2. In the left-side navigation pane, click Backup Schedules. In the top navigation bar, select a region.

  3. On the Backup Schedules page, find the backup schedule for which you want to restore data and click Manage in the Actions column.

  4. On the Sandbox Instance Tasks page, click Recover Sandbox Instance.

  5. In the dialog box that appears, configure the parameters that are described in the following table.

    image.png

    Section

    Parameter

    Description

    Sandbox Instance Point in Time

    Sandbox Data Time Range

    The time range within which data can be restored. 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. The actual available time range may be shorter.

    Note

    Data can be restored within the time range from the point in time at which the first snapshot was created in the 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 point in time.

    Recovery Method

    • Recovery by Snapshot Point in Time: You can select only the point in time at which a snapshot was created. This method takes less time to complete.

    • Recovery by Custom Point in Time: If incremental log backup is enabled, you can restore data to a specific point in time within the time range that is specified for the Available Time Range to Recover parameter. The amount of time required for the restoration varies based on the size of the backup data. If incremental log backup is disabled, you can restore data only to the point in time at which a full backup set was created.

    Sandbox Instance Configurations

    Type of Sandbox Instance

    The type of the sandbox instance. By default, ApsaraDB RDS Instance is selected.

    Edition

    The edition of the sandbox instance. For more information, see Overview.

    Region

    The region in which you want to deploy the sandbox instance. By default, the region in which the backup schedule resides is selected.

    Peer VPC

    The ID of the virtual private cloud (VPC) in which you want to deploy the sandbox instance.

    Note

    If you want to access the sandbox instance from an Elastic Compute Service (ECS) instance, you must set this parameter to the ID of the VPC in which the ECS instance is deployed. For more information about how to create a VPC, see Create and manage a VPC.

    Peer vSwitch

    The ID of the vSwitch in which you want to deploy the sandbox instance. The sandbox instance can be accessed from the CIDR blocks that are specified for the vSwitch.

    Specifications

    The specifications of the sandbox instance. The specifications that are displayed in the console prevail.

  6. Click OK.

    DBS performs a precheck and automatically creates a temporary ApsaraDB RDS for MySQL instance that is used as a sandbox instance. After the state of the sandbox instance changes to Completed, click the endpoint in the Sandbox Instance Address column to go to the ApsaraDB RDS for MySQL console to access the temporary instance.

    image.png

Related operations

Disable the sandbox feature

Note
  • Before you disable the sandbox feature, release the running sandbox instance. On the Sandbox Instance Tasks page, find the sandbox instance that you want to release and click Release Sandbox Instance in the Actions column.

    This operation only deletes the restoration records of the sandbox instance in the DBS console and disassociates the sandbox instance from the temporary ApsaraDB RDS for MySQL instance. The temporary ApsaraDB RDS for MySQL instance is not deleted. After your data is restored, you can go to the ApsaraDB RDS for MySQL console to release the ApsaraDB RDS for MySQL instance if necessary.

  • After you disable the sandbox feature, DBS does not charge you for the sandbox storage.

On the Sandbox Instance Tasks page, click Set Sandbox Policy in the Sandbox Information section. In the Set Sandbox Policy dialog box, turn off Sandbox Feature and click OK.

Release a temporary ApsaraDB RDS for MySQL instance

If you want to release a temporary ApsaraDB RDS for MySQL instance after your data is restored, go to the ApsaraDB RDS for MySQL console. For more information, see Release or unsubscribe from an ApsaraDB RDS for MySQL instance.