Implement disaster recovery by using async replication

更新时间:
复制 MD 格式

After you create and start a replication pair, you can perform a failover if the primary disk fails. This action enables read and write permissions on the secondary disk, which allows you to attach the disk to a temporary ECS instance and keep your services running. After the data is restored, you can resume your services on the primary disk. This topic describes how to implement disaster recovery for a single disk by using the async replication feature.

Limitations

You cannot perform a failover or reverse replication on an individual replication pair that belongs to a replication pair-consistent group. You must manage the pair through the group. For more information, see Implement disaster recovery by using a replication pair-consistent group.

Prerequisites

  • Before you perform a reverse replication, ensure that the primary disk is detached from its ECS instance (for more information, see Detach a data disk) and is in the Unattached state. Alternatively, the ECS instance to which the primary disk is attached must be in the Stopped state.

    Note

    Reverse replication copies data from the secondary disk to the primary disk. During this process, the primary disk must be read-only. Otherwise, the replication fails.

  • (Strongly recommended) Create a snapshot of the disk to back up its data. For more information, see Create a snapshot.

    Note

    Snapshots incur charges. For more information, see Snapshot billing.

( Optional ) Step 1: Disaster recovery drill

A disaster recovery drill does not affect ongoing async replication. While a primary site failure will not impact the drill, a failure at the disaster recovery site can cause it to fail.

  1. Log on to the Elastic Block Storage (EBS) console.

  2. In the left-side navigation pane, choose Enterprise-level Features > Async Replication.

  3. In the top navigation bar, select the region and resource group of the resource that you want to manage. Region

  4. Find the replication pair for the disaster recovery drill and click its ID.

  5. In the Drill section, click Create Drill.

  6. In the Create Drill dialog box, confirm information such as the region, zone, type, and size of the drill disk, and then click OK.

    After the drill is created, a pay-as-you-go disk is created in the same zone as the secondary disk. The new disk has the same type and size as the secondary disk, holds data from the latest recovery point, and can be used to verify your application's integrity and correctness.

    Note
    • You can perform multiple disaster recovery drills as needed to back up data at different recovery points.

    • After verification, we recommend that you delete the drill and the drill disk in the Drill section as soon as possible to reduce costs.

Step 2: Failover

Warning

The failover feature suspends async replication. To prevent data loss, perform a failover only when the primary disk fails.

  1. In the top navigation bar, switch to the secondary disk's region, for example, China (Beijing).

  2. Find the replication pair of the failed primary disk. In the Actions column, choose image> Perform Failover.

  3. Read the notes in the dialog box and click OK.

    After the failover is complete, the status of the replication pair changes to Failed Over.

  4. Attach the secondary disk to a temporary ECS instance to resume your services.

    For more information, see Create an instance by using the wizard and Attach a data disk.

Step 3: Reverse replication

  1. In the top navigation bar, switch to the secondary disk's region, for example, China (Beijing).

  2. Find the replication pair for which the failover is complete. In the Actions column, choose image> Perform Reverse Replication.

  3. In the Perform Reverse Replication dialog box, read the notes and click Create Snapshot to create a snapshot of the source disk (primary disk).

    Important

    Reverse replication overwrites all data on the primary disk with data from the secondary disk. We recommend that you create a snapshot for the primary disk to prevent historical data loss. If you already created a snapshot after repairing the primary disk, you can skip this step.

  4. Click OK to copy the latest data from the secondary disk to the primary disk.

    The status of the replication pair changes to Stopped, and the roles of the primary and secondary disks are reversed. You can view the primary and secondary disks in the Primary Disk/Region/Zone and Secondary Disk/Region/Zone columns of the replication pair list.

    Note

    The roles are reversed. The original primary disk becomes the new secondary disk, and the original secondary disk becomes the new primary disk. For example:

    • Before reverse replication, Disk A in the China (Beijing) region is the primary disk and Disk B in the China (Shanghai) region is the secondary disk.

    • After reverse replication, Disk B in the China (Shanghai) region becomes the primary disk and Disk A in the China (Beijing) region becomes the secondary disk.

  5. In the Actions column for the replication pair, click Start and then click OK to asynchronously replicate data from the original secondary disk to the original primary disk.

    A status of Normal indicates that the data from the original secondary disk has been replicated to the original primary disk, and the data recovery is complete.

  6. (Optional) Switch the roles of the primary and secondary disks in the replication pair back to their initial state.

    The preceding reverse replication steps reverse the primary and secondary roles in the replication pair. If you need to restore the original roles, perform the following operations:

    1. Check the region in the Secondary Disk/Region/Zone column for the current replication pair. In the top navigation bar, switch to that region.

    2. Find the replication pair for which the reverse replication is complete. In the Actions column, choose image.png > Perform Failover.

    3. In the Actions column, choose image.png > Perform Reverse Replication.

    4. After the original disk roles are restored, click Actions in the Start column to re-enable async replication.

    5. In the Primary Disk/Region/Zone and Secondary Disk/Region/Zone columns of the replication pair list, verify that the primary and secondary roles are restored.