All Products
Search
Document Center

ApsaraDB for MongoDB:Migrate an ApsaraDB for MongoDB instance to another region

Last Updated:Sep 24, 2024

This topic describes how to migrate a standalone instance or a replica set instance to another region by using Data Transmission Service (DTS). You can perform full data migration and incremental data migration for a replica set instance. You can perform only full data migration for a standalone instance.

Prerequisites

  • The source instance is a standalone instance, replica set instance, or sharded cluster instance.

    Note

    DTS does not support incremental data migration from a standalone instance. For more information, see Migration types.

  • A public endpoint is applied for the source instance. For more information, see (Optional) Apply for a public endpoint for an ApsaraDB for MongoDB replica set instance.

  • The destination instance is created in the destination region. For more information, see Create an instance.

    Note

    We recommend that you select a storage capacity of 10% larger than the storage capacity used by the source instance for the destination instance.

Background information

You may need to migrate an ApsaraDB for MongoDB instance to another region in the following scenarios:

  • Restructure your business.

  • Use an ApsaraDB for MongoDB instance to provide database services for applications deployed on an Elastic Compute Service (ECS) instance. However, the two instances are not in the same region.

In this example, an ApsaraDB for MongoDB instance in the China (Qingdao) region is migrated to the China (Hangzhou) region.

迁移MongoDB实例至其他地域

Note

This example describes only how to migrate data from the source instance. After data is migrated, you can release the source instance if you no longer need the source instance.

Usage notes

  • DTS uses the resources of the source and destination databases during a full data migration. This may increase the loads on the database servers. If you migrate a large volume of data or the server specifications cannot meet your business requirements, database services may become unavailable. Before you migrate data, evaluate the impact of data migration on the performance of the source and destination instances. We recommend that you migrate data during off-peak hours.

  • DTS does not support incremental data migration from a standalone instance. To ensure data consistency, do not write data to the source instance during the full data migration process.

  • If the source self-managed MongoDB database and the destination instance run different database versions or storage engines, make sure that no compatibility issues occur between them before you start migration. For more information about the database versions and storage engines supported by ApsaraDB for MongoDB, see MongoDB versions and storage engines.

  • By default, a new instance runs the latest minor version. This ensures high performance and stability.

  • The data is concurrently written to the destination instance. Therefore, the storage capacity occupied in the destination instance is 5% to 10% larger than the storage capacity occupied in the source instance.

  • Make sure that the destination instance does not have the same primary key as that in the source instance. The default primary key is _id. Otherwise, data may be lost. If the source and destination instances have the same primary key, delete the corresponding document in the destination instance without interrupting your business services.

Billing

Migration type

Task configuration fee

Internet traffic fee

Full data migration

Free of charge.

Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Billing overview.

Incremental data migration

Charged. For more information, see Billing overview.

Migration types

Migration type

Description

Full data migration

DTS migrates the existing data of objects from the source MongoDB database to the destination MongoDB database.

Note

The following types of objects are supported: database, collection, and index.

Incremental data migration

After full data migration is complete, DTS migrates incremental data from the source MongoDB database to the destination MongoDB database.

Note
  • The create and delete operations that are performed on databases, collections, and indexes can be migrated.

  • The create, delete, and update operations that are performed on documents can be migrated.

Permissions required for database accounts

Database

Full data migration

Incremental data migration

Source instance

Read permissions on the source database

Read permissions on the source database, the admin database, and the local database

Destination instance

Read and write permissions on the destination database

Read and write permissions on the destination database

Note

For more information about how to create and authorize a database account, see Manage the permissions of MongoDB database users.

Procedure

After data is migrated, switch your workloads to the destination instance.

What to do next

If you no longer need the source instance, release the source instance.

  • If the source instance is billed based on the pay-as-you-go billing method, you can release the instance. For more information, see Release an ApsaraDB for MongoDB instance.

  • If the source instance is billed based on the subscription billing method, you are not allowed to release the instance.