This topic describes how to migrate data between ApsaraDB for MongoDB instances created by different Alibaba Cloud accounts by using Data Transmission Service (DTS). DTS supports both full data migration and incremental data migration. You can use these two methods together to migrate data between ApsaraDB for MongoDB instances without interruptions to your business.
Prerequisites
- The source instance is either a standalone instance or a replica set instance. If
the source instance is a sharded cluster instance, we recommend that you use the built-in
commands of MongoDB to migrate data. For more information, see Migrate user-created MongoDB databases to Alibaba Cloud by using the built-in commands of MongoDB.
Note You cannot use DTS to incrementally migrate the data of a standalone instance. For more information, see Migration types.
- The destination instance is created in the destination region. For more information,
see Create a standalone ApsaraDB for MongoDB instance, Create a replica set instance, or Create a sharded cluster instance.
Note The storage capacity of the destination instance must be greater than the occupied storage space of the source instance.
Precautions
- We recommend that you migrate your data during off-peak hours to avoid business interruptions.
- To ensure data consistency, we recommend that you do not write data to the source instance while full data migration of a standalone instance is in progress.
- If the source and destination instances run different database versions or storage engines, ensure there are no compatibility issues 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.
Billing
Migration type | Instance configuration | Internet traffic |
---|---|---|
Full data migration | Free of charge. | Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see DTS pricing. |
Incremental data migration | Charged. For more information, see DTS pricing. |
Migration types
Migration type | Description |
---|---|
Full data migration | DTS migrates all historical data of the required 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 synchronizes incremental data from the
source MongoDB database to the destination MongoDB database.
Note
|
Required database account permissions
Data source | Full data migration | Incremental data migration |
---|---|---|
Source ApsaraDB for MongoDB instance | Read permissions on the source database | Read permissions on the source database, admin database, and local database |
Destination ApsaraDB for MongoDB instance | Read/write permissions on the destination database | Read/write permissions on the destination database |
Preparation
- Log on to the ApsaraDB for MongoDB console with the Alibaba Cloud account to which the source instance belongs.
- Apply for a public endpoint for the source instance. For more information, see Apply for a public endpoint for an ApsaraDB for MongoDB instance.
- Add the Classless Inter-Domain Routing (CIDR) blocks of DTS servers to a whitelist
of the source instance. For more information, see Configure a whitelist for an ApsaraDB for MongoDB instance.
Note You can determine the CIDR blocks you need to add based on the region where the destination instance resides. For more information, see Add the CIDR blocks of DTS servers to the IP whitelist of on-premises databases. For example, if the source instance is in China (Hangzhou) and the destination instance is in China (Shenzhen), add the CIDR blocks of the DTS servers in China (Shenzhen) to a whitelist of the source instance.
Procedure
What to do next
Determine whether to release the source instance.
- If the source instance uses pay-as-you-go billing, release it. For more information, see Release an ApsaraDB for MongoDB instance.
- If the source instance uses subscription billing, you cannot release it.
References
If you migrate data to a sharded cluster instance, you can configure data sharding as needed. For more information, see Configure sharding to maximize the performance of shards.