All Products
Search
Document Center

ApsaraDB for MongoDB:Migrate an ApsaraDB for MongoDB instance to a different zone

Last Updated:Sep 13, 2024

This topic describes how to migrate an ApsaraDB for MongoDB instance to a different zone in the region to which the current zone belongs. After an ApsaraDB for MongoDB instance is migrated to a different zone, the attributes, specifications, and endpoints of the instance remain unchanged.

Prerequisites

  • The instance meets one of the following requirements:

    • The instance is a replica set or sharded cluster instance that uses local disks and runs MongoDB 4.2 or earlier.

    • The instance is a replica set or sharded cluster instance that uses cloud disks and runs MongoDB 4.4 or later.

  • Transparent data encryption (TDE) is disabled for the instance.

  • The source zones and the destination zones belong to the same region.

  • Before you migrate an ApsaraDB for MongoDB instance whose network type is Virtual Private Cloud (VPC) to a different zone, make sure that a vSwitch is created in the zone. For more information about how to create a vSwitch, see Create and manage a vSwitch.

  • The 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 instance to a different zone. For more information about how to release a public endpoint, see Release a public endpoint.

Usage notes

  • When you migrate an ApsaraDB for MongoDB instance whose network type is VPC to a different zone, you cannot change the VPC of the instance.

  • The amount of time 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 instance during off-peak hours.

  • During the migration, the instance is disconnected for about 30 seconds. Make sure that your application can automatically reconnect to the instance.

  • After the migration, the virtual IP addresses (VIPs) of the instance change. A sample VIP is 172.16.88.60. If your application is connected to the instance by using an original VIP after the migration, the application disconnects from the instance.

    Note

    To ensure instance availability, we recommend that you connect to the instance by using the connection string URI of the instance. For more information about how to connect to a replica set instance by using the connection string URI of the instance, see Connect to a replica set instance. For more information about how to connect to a sharded cluster instance by using the connection string URI of the instance, see 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 are deployed in 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 implement disaster recovery across data centers for the 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 how to deploy nodes in a multi-zone replica set instance, see Node deployment policies. For more information about how to deploy nodes in a multi-zone sharded cluster instance, see Node deployment policies.

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.

Important

A single-zone instance that uses local disks can be migrated only to a different zone. To deploy an instance across multiple zones, select a region that includes a combination of multiple zones in the Region (Zone 1, Zone 2, and Zone 3) format, such as Shenzhen (Zone C, Zone D, and Zone E). For more information about supported regions and zones in the preceding format, see Available regions and zones.

Procedure

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the instance resides. Then, find the instance and click the ID of the instance.

  2. In the Basic Information section of the instance details page, click Cross-zone Migration next to Zone.

  3. In the Migrate Instance Across Zones pane, configure the parameters described in the following table based on the disk type of the instance.

    Instance that uses cloud disks

    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.

    Zone Type

    The zone deployment mode. Valid values: Single-zone or Multi-zone.

    Migrate To

    The destination zone.

    If you set the Zone Type parameter to Multi-zone, configure the Migrate Data from Secondary Zone 1 to and Migrate Data from Secondary Zone 2 to parameters.

    Current VPC

    Set the value to the VPC to which the instance belongs.

    Select vSwitch

    The destination vSwitch.

    Switching Time

    The time period for the instance 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: specifies the time period for the instance migration. You can select the current maintenance window or specify a custom maintenance window based on your business requirements.

      1. Click Edit next to Switch within Maintenance Window.

      2. In the Specification Information section of the instance details page, click Edit next to Maintenance Window to specify a maintenance window. For more information, see Specify a maintenance window.

    Instance that uses local disks

    The parameters that you need to configure vary based on the instance network type.

    • If the ApsaraDB for MongoDB instance resides in a VPC or runs in hybrid access mode, configure the parameters described in the following table.

      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

      The destination zone.

      Current VPC

      Set the value to the VPC to which the instance belongs.

      Select vSwitch

      The destination vSwitch.

      Switching Time

      The time period for the instance 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: specifies the time period for the instance migration. You can select the current maintenance window or specify a custom maintenance window based on your business requirements.

        1. Click Edit next to Switch within Maintenance Window.

        2. In the Specification Information section of the instance details page, click Edit next to Maintenance Window to specify a maintenance window. For more information, see Specify a maintenance window.

    • If the ApsaraDB for MongoDB instance resides in the classic network, configure the parameters described in the following table.

      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

      The destination zone.

      Switching Time

      The time period for the instance 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: specifies the time period for the instance migration. You can select the current maintenance window or specify a custom maintenance window based on your business requirements.

        1. Click Edit next to Switch within Maintenance Window.

        2. In the Specification Information section of the instance details page, click Edit next to Maintenance Window to specify a maintenance window. For more information, see Specify a maintenance window.

  4. Read the prompt and select the check box.

  5. Click OK.

FAQ

Can I migrate an ApsaraDB for MongoDB instance for which the disk encryption feature is enabled to a different zone?

Yes, you can migrate an ApsaraDB for MongoDB instance for which the disk encryption feature is enabled to a different zone.