This topic describes how to migrate an ApsaraDB for MongoDB instance across zones in the same region. After the instance is migrated, its attributes, specifications, and connection addresses remain unchanged.

Prerequisites

  • The instance is a replica set or sharded cluster instance.
  • The destination and source zones are in the same region.
  • If the instance is in a VPC, make sure that a VSwitch is created in the destination zone before you start migration. For more information, see Create a VSwitch.
  • The instance does not have a public endpoint. If you have applied for a public endpoint, you must release it before migration. For more information, see Release a public connection string.

Precautions

  • If the instance is in a VPC, you cannot change the VPC while you migrate the instance across zones.
  • The time required varies depending on factors such as the network conditions, task queue status, and data volume. We recommend that you migrate the instance across zones during off-peak hours.
  • While you migrate an instance across zones, there is a brief disconnection of 30 seconds. Make sure that your application is configured to reconnect to the instance after it is disconnected.
  • Migrating an instance across zones causes changes to virtual IP addresses (VIPs), such as 172.16.88.60. If your application uses the original VIP, it cannot connect to the instance after migration.
    Note We recommend that you use a connection string URI to connect to the instance, which ensures high availability. For more information, see Overview of replica set instance connections or Overview of sharded cluster instance connections.

Supported migration types and scenarios

Migration type Scenario
Migrate an ApsaraDB for MongoDB instance from one zone to another The ApsaraDB for MongoDB instance is migrated to the zone where an ECS instance resides. Then the ECS instance can connect to the ApsaraDB for MongoDB instance over the internal network with lower network latency.
Migrate an ApsaraDB for MongoDB instance from one zone to multiple zones The ApsaraDB for MongoDB instance provides disaster recovery across data centers.
The three nodes of a replica set instance are deployed to three different zones in the same region. This enables the instance to tolerate disasters at higher levels. For example, a replica set instance in a single zone can only tolerate server- and rack-level faults, whereas a replica set instance in multiple zones can tolerate server-, rack-, and data center-level faults.
Note For more information about the node deployment policy of a replica set instance or a sharded cluster instance in multiple zones, see Node deployment policies or Figure 1
Migrate an ApsaraDB for MongoDB instance from multiple zones to one zone Special user requirements are met.

Migrate a replica set instance across zones in the same region

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. In the left-side navigation pane, click Replica Set Instances.
  4. Find the target instance and click its ID.
  5. In the Basic Information section, click Change Zone.
    Click Change Zone
  6. In the dialog box that appears, configure parameters based on the network type of the instance.
    • When the instance is in a VPC or is in hybrid network access mode:
      1. Select the destination zone and VSwitch.Migrate an ApsaraDB for MongoDB instance in a VPC across zones
      2. Specify Migration Time and select the check box of the warning message.
    • When the instance is in a classic network:
      1. Select the destination zone.Migrate an ApsaraDB for MongoDB instance in a classic network across zones
      2. Specify Migration Time and select the check box of the warning message.
    Note
    • Migrate Now: The migration starts immediately. When the instance status changes to Running, the migration is complete.
    • Migrate at Scheduled Time: The migration starts during the specified period. You can click Edit to change the period.

      After you select this option, the system prepares for the migration task and changes the instance status to Migrating. It will start the task in the specified period.

  7. Click Submit.

Migrate a sharded cluster instance across zones in the same region

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. In the left-side navigation pane, click Sharded Cluster Instances.
  4. Find the target instance and click its ID.
  5. In the Basic Information section, click Change Zone.
    Click Change Zone
  6. In the dialog box that appears, configure parameters based on the network type of the instance.
    • When the instance is in a VPC or is in hybrid network access mode:
      1. Select the destination zone and VSwitch.Migrate an ApsaraDB for MongoDB instance in a VPC across zones
      2. Specify Migration Time and select the check box of the warning message.
    • When the instance is in a classic network:
      1. Select the destination zone.Migrate an ApsaraDB for MongoDB instance in a classic network across zones
      2. Specify Migration Time and select the check box of the warning message.
    Note
    • Migrate Now: The migration starts immediately. When the instance status changes to Running, the migration is complete.
    • Migrate at Scheduled Time: The migration starts during the specified period. You can click Edit to change the period.

      After you select this option, the system prepares for the migration task and changes the instance status to Migrating. It will start the task in the specified period.

  7. Click Submit.