tencent cloud

Feedback

Migration Operation Guide

Last updated: 2024-10-08 14:18:59

    Overview

    DTS-based MongoDB data migration supports both full and incremental data migration, meaning that the historical data from the source database as well as the newly written data during the migration process can be migrated together.
    This document provides instructions on how to use the DTS data migration feature to migrate data from MongoDB to TencentDB for MongoDB.

    Preparation

    1. Ensure that the access channel between DTS and the database is established in advance according to the type of access you plan to use. For detailed instructions, see Network Preparation Work.
    IDC self-hosted databases/other cloud provider databases: The available access methods include Public Network/Direct Connect/VPN Access/CCN.
    Self-built databases on CVM: The access method should be Self-Build on CVM.
    TencentDB instances: The access method should be Database.
    2. It is recommended to create a read-only account in the source database for migration purposes. See the following method.
    use admin
    db.createUser({user: "username",pwd: "password",roles:[{role: "readAnyDatabase", db: "admin"},{role: "read", db: "local"}]})
    3. If the target database is a TencentDB instance, you can use the mongouser account for migration, or you can create your own account. The method for creating an account is as follows.
    db.createUser({user:"username",pwd:"password",roles:[{role:"readWriteAnyDatabase",db:"admin"}]})

    Operation Steps

    1. Log in to the DTS console, choose the Data Migration page in the left sidebar, and click Create Migration Task to enter the Create Migration Task page.
    2. On the Create Migration Task page, select the source instance type and region, the target instance type and region, and the specifications. Then, click Purchase Now.
    Configuration Parameter
    Description
    Creation Mode
    Create new task: Create a brand new task.
    Create similar task: Quickly create a task with the same configuration as a previous task. In the new task, the options for database type, access method, billing mode, and migration type are pre-filled to match the previous task. Users can modify these options as needed based on the current situation.
    Source Instance Type
    Select based on the type of your source database. This cannot be changed after purchase. For this scene, select MongoDB.
    Source Instance Region
    Select the region where the source database is located. If the source is a self-hosted database, select the region closest to the self-hosted database.
    Target Instance Type
    Select based on the type of your target database. This cannot be changed after purchase. For this scene, select MongoDB.
    Target Instance Type
    Select the region where the target database is located.
    Version
    The default is NewDTS; no modification is needed.
    Specification
    Currently, only the Medium specification is supported.
    Task Name
    Select Name After Creation. The task name will be the same as the task ID by default. After the migration task is created, you can rename the task.
    Select Name Now, and enter the task name in the input field below.
    3. After the purchase is completed, the page will automatically redirect to the data migration task list. Select the task you just purchased to proceed with the configuration.
    If you have purchased multiple regions or are configuring cross-region tasks, the task list will display tasks based on the region of the target instance. You can switch regions at the top of the page to find the tasks you have purchased.
    4. On the set source and target database page, complete the task settings, source database settings, and target database settings.
    Note:
    Enter the read-only account that was previously created for the source database; otherwise, the pre-check step will fail.
    If the source or target database is a TencentDB instance, DTS will use a system service account to export or write data during the migration process. For example, if the source database is a TencentDB instance, DTS will connect to the source database using the read-only account provided by the user, and also use a system service account to export data from the source. Similarly, if the target database is a TencentDB instance, DTS will connect to the target database using the account provided by the user, and use a system service account to write data to the target.
    
    Configuration Parameter
    Description
    Task Name
    Set a business-relevant name for easy task identification.
    Run Mode
    Immediate execution: The task will start immediately after the pre-check passes.
    Scheduled execution: Set a specific start time for the task. The task will not start immediately after the pre-check passes, but will instead start at the scheduled time.
    Access Type
    Select based on your specific scene. For preparation steps related to different access types, see the Overview.
    Public Network: The source database can be accessed via a public IP.
    Self-Build on CVM: The source database is deployed on a Tencent Cloud Service CVM.
    Direct Connect: The source database can connect to Tencent Cloud Virtual Private Cloud via Direct Connect.
    VPN Access: The source database can connect to Tencent Cloud Virtual Private Cloud via VPN Connections.
    Database: The source database is a TencentDB instance.
    CCN: The source database can connect to Tencent Cloud Virtual Private Cloud via Cloud Connect Network.
    If the source database is a self-hosted IDC database or a database from another cloud provider, you can choose Public Network/Direct Connect/VPN Access/CCN as the access method. If the source database is self-hosted on a CVM, select Self-Hosted on CVM as the access method. If the source database is a TencentDB instance, select Database as the access method.
    Architecture
    This parameter is displayed when Access Type is set to Self-Build on CVM/Direct Connect/VPN Access/CCN. Select it according to your actual situation.
    Replica set: Refers to an architecture where the source database is a replica set, consisting of one Primary node and one or more Secondary nodes.
    Cluster migration: Refers to an architecture where the source database is a sharded cluster, consisting of components such as mongos nodes, config servers, and shard nodes.
    Single node: Refers to an architecture where the source database cluster consists of a single node that handles both read and write operations.
    Note:
    Once you select an architecture type, and the connectivity test passes. It cannot be changed to another architecture type; otherwise, the task will encounter errors.
    Cluster Migration
    When Architecture is set to Cluster migration, the following parameters need to be configured.
    Node - mongod: Enter the IP and port, or the domain name and port, of the mongod node. For multiple nodes, enter each on a new line; only one mongod needs to be entered for each shard. Example: 1xx.xx.55.77:6xx9.
    Node - mongos: Enter the IP and port, or the domain name and port, of the mongos node.
    Node - Config Server: Enter the IP and port, or the domain name and port, of the Config Server node.
    Public Network
    When Access Type is set to Public Network, the following parameters need to be configured.
    Host address: The IP address or domain name of the source database.
    Port: The port used by the source database.
    Self-Build on CVM
    When Access Type is set to Self-Build on CVM", the following parameters need to be configured.
    CVM instance: The instance ID of the CVM.
    Port: The port used by the source database.
    Direct Connect
    When Access Type is set to Direct Connect, the following parameters need to be configured.
    VPC Direct Connect Gateway: Only the VPC Direct Connect Gateway is supported for Direct Connect. Confirm the network type associated with the gateway.
    VPC: Select the VPC and subnet.
    Host address: The IP address or the domain name of the source database.
    Port: The port used by the source database.
    VPN Access
    When Access Type is set to VPN Access, the following parameters need to be configured.
    VPN gateway: Select the VPN gateway instance that is accessed through the VPN gateway.
    VPC: Select the VPC and subnet.
    Host address: The IP address or the domain name of the source database.
    Port: The port used by the source database.
    Database
    When Access Type is set to Database, the following parameters need to be configured.
    Cloud database instance: Select the instance ID of the source database.
    CCN
    When Access Type is set to CCN, the following parameters need to be configured.
    When using CCN for access, both same-account CCN and cross-account CCN are supported. Due to the complexity of network configuration, see Migrating Self-built Databases to Tencent Cloud via Cloud Connect Network.
    Host network environment: Select according to your actual situation. For example, if the source database is a TencentDB instance, select Tencent Cloud; if the source database is a self-hosted IDC database, select Self-built IDC; if the source database is from another cloud provider, select the corresponding network.
    Host address: The host IP address or the domain name of the source database.
    Port: The port used by the source database.
    CCN instance account
    My account: The CCN resources and DTS belong to the same Tencent Cloud root account.
    Other account: The CCN resources and DTS belong to different Tencent Cloud root accounts.
    VPC CCN: The name of the CCN instance.
    Access VPC: Select the VPC and subnet to be accessed. The Access VPC refers to the VPC that is connected to the DTS migration linkage within the CCN. Choose a VPC other than the one that the source database belongs to from all the VPCs associated with the CCN.
    Access VPC region: The region of the Access VPC should match the region of the source database selected when purchasing the task. If they do not match, DTS will change the region of the source database selected in the purchased task to the Access VPC region.
    Authentication Required
    Whether security authentication for the username and password of the source database is required. If Required is selected, the following parameters need to be filled in.
    Authentication database: The name of the database that requires authentication, i.e., the database name associated with the account executing the migration task. Only admin is supported.
    Authentication mechanism: Currently, only SCRAM-SHA-1 is supported.
    Account and password options
    Same account and password: Select this parameter if the same account and password are used for the roles of mongod, mongos, and Config Server, and enter the unified account and password.
    Different accounts and passwords: Select this parameter if different accounts and passwords are used for the roles of mongod, mongos, and Config Server, and enter the account and password for each mongod, mongos, and Config Server separately.
    Account/Password
    Account/Password: The account and password of the source database.
    5. Test the connectivity between the source and target instances. If the connectivity test fails, see Connectivity Test Failure for troubleshooting.
    6. On the Set migration options and select migration objects page, configure the migration options and select the migration objects.
    Configuration Parameter
    Description
    Migration Type
    Select based on your scene.
    Full migration: Migrates the entire database, including only the data that exists in the source database at the time the task is initiated, and not including any new data written to the source database after the task starts.
    Full + Incremental migration: Migrates both the existing data in the source database at the time the task is initiated and any new data written to the source database in real-time after the task starts. If data is being written to the source database during the migration and you need a seamless migration without downtime, select this option.
    Data Consistency Check
    Data consistency check is supported only when the Migration Type is configured as Full + Incremental Migration, allowing a detailed comparison of data between the source and target databases after migration. When the Migration Type is configured as Full Migration, consistency check is disabled by default.
    Full object consistency check: After the incremental synchronization is completed, DTS will automatically trigger a consistency check task.
    No check: Data consistency will not be checked. If needed, you can manually trigger a consistency check after the incremental synchronization is completed. For details, see Creating Data Consistency Check Task.
    Data Check
    When Data Consistency Check is set to Full migration object detection, the default consistency check type displayed is Content Validation.
    Migration Objects
    Entire instance: Migrates the entire instance, excluding system databases, such as system objects in PostgreSQL. However, it will migrate roles and user metadata definitions.
    Specified objects: Migrates only the specified objects.
    Specified Objects
    Select the objects to be migrated from the source database and move them to the Selected Object box.
    7. On the validation task page, complete the pre-migration validation, and then click Start Task. If the validation task fails, you can see Handling Methods for Validation Failure to resolve the issue and then reinitiate the validation task.
    Failed: Indicates that the validation item did not pass the check, blocking the task. The issue should be fixed before re-running the validation task.
    Warning: Indicates that the validation item does not fully meet the requirements. You can continue the task, but it may have some impact on the business. The user needs to evaluate whether to ignore the warning or fix the issue before proceeding, based on the provided information.
    8. Return to the migration task list, where the synchronization task will be running.
    If you need to view task details, delete tasks, or perform other actions, click the corresponding task operation. For more information, see Task Management. If a task error occurs, see Error Handling.
    9. End the task.
    Select Full migration: The task will automatically end upon completion, with no need for manual intervention.
    Select Full + Incremental migration: After the full migration is completed, the task will enter the incremental data synchronization phase. Incremental data synchronization will not end automatically and requires the user to manually end the task.
    Once incremental synchronization is completed (i.e., the status is Ready to Complete) and the time delay between the target and source databases is 0 seconds, click Complete in the Operation column to end the migration task.
    10. (Optional) If a cutover is required, you can perform the official cutover of your business once the task status changes to Task successful after the task is completed. For more details, see Cutover Instructions.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support