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 a 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 about how to create a vSwitch, see Create VSwitch.
  • The instance cannot have a public IP address. If you have applied for a public IP address, You must release it before migration. For more information about the release process, 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 ConnectionstringURI to connect to the ApsaraDB for MongoDB instance, which ensures high availability. For more information about the endpoint, see Overview of replica set instance connections. for more information about sharded cluster instance, see 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. This way, 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 and sharded cluster instances in multiple zones, see Node deployment policiesor Figure 1.
Migrate an ApsaraDB for MongoDB instance from multiple zones to one zone Special user requirements are met.

For a replica set instance

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the region of the instance.
  3. In the left-side navigation pane, click Replica Set Instances.
  4. Find the 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.
      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.
      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 OK.

For sharded cluster instances

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the region of the instance.
  3. In the left-side navigation pane, click Sharding Instances.
  4. Find the 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.
      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.
      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.