All Products
Search
Document Center

ApsaraDB for MongoDB:Migrate across zones

Last Updated:Jul 30, 2026

Migrate an ApsaraDB for MongoDB instance to another zone within the same region. Account credentials and connection addresses remain unchanged after the migration.

Prerequisites

  • The instance meets one of the following requirements:

    • A replica set or sharded cluster instance that uses local disks and runs MongoDB 4.0 or 4.2.

    • 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 target zone is in the same region as the instance's current zone.

  • Before you migrate an instance that is deployed in a VPC, you must make sure that a vSwitch is created in the destination zone. For more information about how to create a vSwitch, see Create and manage vSwitches.

  • An instance with local disks cannot have a public endpoint when you migrate it to a different zone. If the instance has a public endpoint, you must release it first. For more information, see Release a public endpoint.

Considerations

  • You cannot change the VPC of the instance during the zone migration.

  • The migration duration depends on network conditions, the task queue, and data volume. Perform this operation during off-peak hours.

  • The switchover during the migration causes a transient connection interruption of about 30 seconds. Ensure that your application has an automatic reconnection mechanism.

  • The zone migration changes the virtual IP address (VIP) of the instance, for example, 172.16.88.60. If your application connects using the VIP, it will lose connectivity.

    Note

    We recommend that you use a connection string URI to connect to your instance to ensure high availability. For replica set instances, see Connect to a replica set instance. For sharded cluster instances, see Connect to a sharded cluster instance.

Migration types and scenarios

Migration type

Scenario

Single-zone to another single-zone

Co-locate the ApsaraDB for MongoDB instance with ECS instances in the same zone to reduce network latency.

Single-zone to multi-zone

Improve disaster recovery (DR) capabilities by enabling cross-data-center failover.

A single-zone deployment tolerates server-level and rack-level failures, whereas a multi-zone deployment tolerates data-center-level failures. For example, deploying the nodes of a three-node replica set across three zones in the same region provides higher fault tolerance.

Note

For more information about the node deployment policies for multi-zone replica set and sharded cluster instances, see Node deployment policies or Create a multi-zone sharded cluster instance.

Multi-zone to single-zone

To meet specific feature requirements.

Single-zone to dual-zone

Convert a single-zone instance to a dual-zone instance to improve disaster recovery capability and achieve cross-rack fault tolerance.

Dual-zone to single-zone

Convert a dual-zone instance to a single-zone instance. This is useful when cross-zone disaster recovery is no longer needed or when you want to simplify the deployment architecture.

Multi-zone to another multi-zone

To accommodate an instance upgrade requiring more resources.

Important
  • MongoDB instances with local disks support only migration from one single zone to another single zone. If you want to implement a multi-zone deployment, you can select a zone in the format of Region (Zone 1+Zone 2+Zone 3), for example, Shenzhen Zone (C+D+E). Zones in the preceding format are supported only in some regions. For more information, see Supported regions and zones.

  • ApsaraDB for MongoDB instances that use cloud disks support changing the instance type during zone migration.

Procedure

  1. Go to the ApsaraDB for MongoDB Replica Set Instances or ApsaraDB for MongoDB Sharded Cluster Instances page, select a region and resource group at the top of the page, and then click the target instance's ID.

  2. In the Basic Information section, click Cross-zone Migration to the right of Zone.

  3. In the Migrate Instance Across Zones panel, configure the parameters.

    The parameters vary based on the disk type of the instance.

    Cloud disk

    Parameter

    Description

    Instance

    The ID of the current instance.

    Current Zone

    The zone where the instance currently resides.

    Deployment Type

    Select Single-zone or Multi-zone based on your needs.

    Migrate To

    Select the target zone.

    If you select Multi-zone for the Deployment Type parameter, you must also configure the Migrate Data from Secondary Zone 1 to and Migrate Data from Secondary Zone 2 to parameters.

    Current VPC

    The VPC to which the instance currently belongs.

    Select vSwitch

    Select the target vSwitch.

    Switchover Time

    Select when the switchover takes effect.

    • Switch Immediately after Migration: The system starts the zone migration task immediately after you configure the parameters and switches the instance over as soon as the task is complete.

    • Switch within Maintenance Window: The system performs the switchover during the specified maintenance window. You can use the current maintenance window or change it based on your business requirements.

      1. Click Switch within Maintenance Window to the right of Edit to change the maintenance window.

      2. In the Specification Information section, click Edit next to Maintenance Window to set the switchover time. For more information, see Set a maintenance window.

    Local disk

    For local disk instances, parameters vary depending on the network type.

    • Network type: VPC or hybrid of VPC and classic network

      Parameter

      Description

      Instance

      The ID of the current instance.

      Current Zone

      The zone where the instance currently resides.

      Migrate To

      Select the target zone.

      Current VPC

      The VPC to which the instance currently belongs.

      Select vSwitch

      Select the target vSwitch.

      Switchover Time

      Select when the switchover takes effect.

      • Switch Immediately after Migration: The system starts the zone migration task immediately after you configure the parameters and switches the instance over as soon as the task is complete.

      • Switch within Maintenance Window: The system performs the switchover during the specified maintenance window. You can use the current maintenance window or change it based on your business requirements.

        1. Click Switch within Maintenance Window to the right of Edit to change the maintenance window.

        2. In the Specification Information section, click Edit next to Maintenance Window to set the switchover time. For more information, see Set a maintenance window.

    • Network type: classic network

      Parameter

      Description

      Instance

      The ID of the current instance.

      Current Zone

      The zone where the instance currently resides.

      Migrate To

      Select the target zone.

      Switchover Time

      Select when the switchover takes effect.

      • Switch Immediately after Migration: The system starts the zone migration task immediately after you configure the parameters and switches the instance over as soon as the task is complete.

      • Switch within Maintenance Window: The system performs the switchover during the specified maintenance window. You can use the current maintenance window or change it based on your business requirements.

        1. Click Switch within Maintenance Window to the right of Edit to change the maintenance window.

        2. In the Specification Information section, to the right of Maintenance Window, click Edit to set the switchover time. For more information, see Set a maintenance window.

  4. Read the on-screen information and select the confirmation checkbox.

  5. (Optional) Select Change Configuration to change the instance type during the zone migration.

  6. Click OK.

FAQ

Q: Can I migrate a cloud disk instance if disk encryption is enabled?

A: Yes. Zone migration is supported for instances with disk encryption enabled.