This topic describes how to migrate data between ApsaraDB for MongoDB instances of different Alibaba Cloud accounts by using Data Transmission Service (DTS). DTS supports full data migration and incremental data migration. When you migrate data between ApsaraDB for MongoDB instances, you can select both of the supported migration types to ensure service continuity.
Prerequisites
- The source instance is 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 tools
of MongoDB to migrate data. For more information, see Migrate a self-managed MongoDB database to ApsaraDB for MongoDB by using tools provided by MongoDB.
Note DTS does not support incremental data migration from a standalone instance. For more information, see Migration types.
- The destination instance is created in the destination region. For more information,
see Create standalone instances, Create replica set instances, or Create a sharded cluster instance.
Note The available storage space of the destination instance must be larger than the total size of the data in the source instance.
Precautions
- DTS consumes the resources of the source and destination instances during full data migration. This may increase the loads of the database servers. If you migrate a large volume of data or the server specifications cannot meet your requirements, database services may become unavailable. Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. 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 full data migration.
- If the source and destination MongoDB databases use different versions or storage engines, make sure that your applications can run on both databases. For more information about the versions and storage engines that are supported by ApsaraDB for MongoDB, see MongoDB versions and storage engines.
- To ensure better performance and stability of the instance, the system will upgrade the minor version to the latest version by default. If the minor version of your instance expires or is not included in the maintenance list and the instance is upgraded, migrated, changed, Created from a backup, Created by point-in-time, or performed Restore data to a new ApsaraDB for MongoDB instance.
Pricing
Migration type | Instance 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 DTS pricing. |
Incremental data migration | Charged. For more information, see DTS pricing. |
Migration types
Migration type | Description |
---|---|
Full data migration | All data of the migration objects is migrated from the source instance to the destination
instance.
Note The following types of objects are supported: database, collection, and index.
|
Incremental data migration | Updated data of the migration objects is synchronized from the source instance to
the destination instance.
Note
|
Permissions required for database accounts
Database | Full data migration | Incremental data migration |
---|---|---|
Source ApsaraDB for MongoDB instance | The read permissions on the source database | The read permissions on the source database, the admin database, and the local database |
Destination ApsaraDB for MongoDB instance | The read and write permissions on the destination database | The read and write permissions on the destination database |
Before you begin
- Log on to the ApsaraDB for MongoDB console by using the Alibaba Cloud account that owns the source instance.
- Apply for a public endpoint for the source instance. For more information, see Apply for a public endpoint.
- Add the CIDR blocks of DTS servers to the whitelist of the source instance. For more
information, see Configure a whitelist or an ECS security group 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 security settings of on-premises databases.
For example, if the source instance resides in the China (Hangzhou) region and the destination instance resides in the China (Shenzhen) region, you must add the CIDR blocks of DTS servers in the China (Shenzhen) region to the whitelist of the source instance.
Procedure
References
If you migrate data to a sharded cluster instance, you can configure data sharding based on your needs. For more information, see Configure sharding to maximize the performance of shards.