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

Prerequisite

  • The ApsaraDB for MongoDB instance is a replica set instance or sharded cluster instance that runs MongoDB 4.2 or later.
  • Transparent data encryption (TDE) is not enabled for the ApsaraDB for MongoDB instance.
  • The source zones and the destination zones belong to the same region.
  • vSwitches are created in the destination zones. This prerequisite must be met if the ApsaraDB for MongoDB instance resides in a virtual private cloud (VPC). For more information about how to create a vSwitch, see Work with vSwitches.
  • The ApsaraDB for MongoDB instance does not have a public endpoint. If you have applied for a public endpoint, you must release the public endpoint before you migrate the ApsaraDB for MongoDB instance to different zones. For more information about how to release a public endpoint, see Release a public endpoint.

Precautions

  • If the ApsaraDB for MongoDB instance resides in a VPC, the destination zones must belong to the VPC of the instance.
  • The time that is required for the migration varies based on factors such as the network conditions, task queue status, and data volume. We recommend that you migrate the ApsaraDB for MongoDB instance during off-peak hours.
  • During the migration, you may experience transient connections that last about 30 seconds. Make sure that your application is configured to automatically reconnect to the ApsaraDB for MongoDB instance.
  • After the migration, the virtual IP addresses (VIPs) of the ApsaraDB for MongoDB instance change. A sample VIP is 172.16.88.60. If your application is connected to the ApsaraDB for MongoDB instance by using the original VIPs after the migration, the application disconnects from the instance.
    Note We recommend that you connect your application to the ApsaraDB for MongoDB instance by using the Uniform Resource Identifier (URI) of the instance. This allows you to ensure high availability. For more information, see Connect to a replica set instance and Connect to a sharded cluster instance.

Supported migration types and scenarios

Migration type Scenario
Migrate the ApsaraDB for MongoDB instance from one zone to another zone You want to migrate the ApsaraDB for MongoDB instance to the zone of a specific Elastic Compute Service (ECS) instance. An ECS instance and an ApsaraDB for MongoDB instance that belong to the same zone can communicate over an internal network at low network latency.
Migrate the ApsaraDB for MongoDB instance from one zone to multiple zones You want to achieve disaster recovery across data centers for the ApsaraDB for MongoDB instance.
An ApsaraDB for MongoDB instance that is deployed in a single zone can tolerate server- and rack-level faults. An ApsaraDB for MongoDB instance that is deployed in multiple zones can tolerate data center-level faults. For example, you can deploy the three nodes of a replica set instance in three different zones of the same region. This way, the replica set instance can tolerate data center-level disasters.
Note For more information about the node deployment policies that are supported by replica set instances and sharded cluster instances, see Node deployment policies and Figure 1.
Migrate the ApsaraDB for MongoDB instance from multiple zones to one zone You want to migrate the ApsaraDB for MongoDB instance based on your business requirements.
Migrate the ApsaraDB for MongoDB instance from multiple zones to multiple different zones You want to migrate the ApsaraDB for MongoDB instance to multiple different zones that can provide sufficient resources for instance upgrades.

Procedure

  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 or Sharded Cluster Instances.
  4. Find the target instance and click its ID.
  5. In the Basic Information section of the page that appears, click Change Zone.
    Click Change Zone
  6. In the Migrate Instance to Other Zone pane, configure the parameters based on the network type of the ApsaraDB for MongoDB instance.
    • If the ApsaraDB for MongoDB instance resides in a VPC or runs in hybrid access mode, configure the following parameters. Migrate an ApsaraDB for MongoDB instance in a VPC to different zones
      Parameter Description
      Instance Set the value to the ID of the current instance.
      Current Zone Set the value to the current zone ID of the instance.
      Migrate To Select the destination zones.
      Select a vSwitch Select the destination vSwitch.
      Migration Time The time when you want to start the migration. Valid values:
      • Switch Immediately after Migration: ApsaraDB for MongoDB starts the migration immediately after you configure the parameters. Business is switched immediately after the migration task is completed.
      • Switch within Maintenance Window: ApsaraDB for MongoDB starts the migration during the maintenance window that you specify. You can view the maintenance window. You can also change the maintenance window based on your business requirements by using one of the following methods:
        • In the Migrate Instance to Other Zone pane, click Edit next to Switch within Maintenance Window.
        • In the Specification Information section of the Basic Information page, click Edit next to Maintenance Period. For more information, see Specify a maintenance period.
    • If the ApsaraDB for MongoDB instance resides in the classic network, configure the following parameters. Migrate an ApsaraDB for MongoDB instance in the classic network to different zones
      Parameter Description
      Instance Set the value to the ID of the current instance.
      Current Zone Set the value to the current zone ID of the instance.
      Migrate To Select the destination zones.
      Migration Time The time when you want to start the migration. Valid values:
      • Switch Immediately after Migration: ApsaraDB for MongoDB starts the migration immediately after you configure the parameters. Business is switched immediately after the migration task is completed.
      • Switch within Maintenance Window: ApsaraDB for MongoDB starts the migration during the maintenance window that you specify. You can view the maintenance window. You can also change the maintenance window based on your business requirements by using one of the following methods:
        • In the Migrate Instance to Other Zone pane, click Edit next to Switch within Maintenance Window.
        • In the Specification Information section of the Basic Information page, click Edit next to Maintenance Period. For more information, see Specify a maintenance period.
  7. Read the message that is displayed and select the check box next to the message.
  8. Click Submit.