tencent cloud

Feedback

Operation Guide

Last updated: 2024-11-04 10:04:25

    Overview

    This document describes how to use the Data Transfer Service (DTS) logical migration feature to migrate data from PostgreSQL to TencentDB for PostgreSQL.

    Preparations

    1. Read the Logical Migration Instructions carefully to understand feature restrictions and precautions.
    2. Establish an access channel between DTS and databases in advance according to the access type you need. For details, see Overview of Preparations Related to Network.
    Self-built databases in Internet Data Center (IDC)/Databases of other cloud vendors: Select public network, Direct Connect, Virtual Private Network (VPN) access, or Cloud Connect Network (CCN) as the access method.
    When migrating via the public network, ensure that the source instance service is accessible under the public network environment and that the public network connection remains stable. Network fluctuations or failures may cause the migration to fail. If the migration fails, a new migration task will need to be initiated.
    Self-built databases on Cloud Virtual Machine (CVM): Select Self-Build on CVM as the access method.
    TencentDB instances: Select Database as the access method.
    3. The permissions required for the source database are as follows:
    If the source database is a PostgreSQL database other than TencentDB for PostgreSQL, the source database account must have replication permissions; otherwise, the verification will fail.
    If the source database is TencentDB for PostgreSQL, the source database account must be the initialization user specified when the TencentDB instance is created.
    If you do not have permissions for some tables or objects, you can use a high-privilege user account to execute the following example statements to grant permissions for the objects respectively:
    grant select on table table name to username;
    grant select on SEQUENCE sequence name to username;
    grant connect on database database name to username;
    grant select on large object large object OID to username;
    GRANT USAGE ON SCHEMA schema name to username;
    4. The permissions required for the target database are as follows:
    The target database account must be the initialization user specified when the TencentDB instance is created.
    If the database to be migrated exists in the target database instance but the database's owner is not the current migration user, you can execute the following statement to grant the database to the migration user:
    alter database database name owner to migration user;
    If the migration user (the account executing a migration task) is not a pg_tencentdb_superuser role user, during verification, you will receive an error message saying "Target instance permission check failed, unable to get Schema List." In this case, use the following statement to grant initialization user permissions to the migration user.
    grant pg_tencentdb_superuser to migration user;

    Directions

    1. (Optional) When performing full + incremental migration using PostgreSQL 9.4, 9.5, or 9.6 as the source database, you need to refer to the following guide to install the tencent_decoding plugin. Skip this step for other scenarios.
    1.1 Download the corresponding plugin based on the system architecture of the server where the source database is located.
    Only system architectures x86_64 and AArch64 are supported.
    The plugin version must be consistent with the PostgreSQL version.
    The Glibc version must meet the following requirements: For x86_64 systems, it should not be earlier than version 2.17 - 323, and for AArch64 systems, it should not be earlier than version 2.17 - 260.
    Check the Glibc version on a Linux system:
    RHEL/CentOS: rpm -q glibc
    Check the Glibc version on other operating systems (such as Debian, Ubuntu, and SUSE):
    ldd --version | grep -i libc
    1.2 Place the downloaded tencent_decoding.so file in the lib folder of the PostgreSQL process directory. You do not need to restart the instance.
    2. Log in to the DTS console, select Data Migration in the left sidebar, and click Create Migration Task to enter the Create Migration Task page.
    3. On the Create Migration Task page, select the source instance type and region, target instance type and region, and specification, and then click Buy Now.
    Configuration Item
    Description
    Source Instance Type
    Choose according to your source database type. It cannot be modified after purchase. This example uses "PostgreSQL".
    Source Instance Region
    Select the region of the source database. If the source database is a self-built one, select a region nearest to it.
    Target Instance Type
    Choose according to your target database type. It cannot be modified after purchase. This example uses "PostgreSQL".
    Target Instance Region
    Select the region of the target database.
    Specification
    Select the specification of a migration link according to your business conditions. For the performance and billing details of different specifications, see Billing Overview.
    4. On the Set Source and Target Databases page, complete task settings, source database settings, and target database settings. Once the connectivity test between the source and target databases succeeds, click Create.
    Note:
    If the connectivity test fails, troubleshoot and fix the issues as prompted in Fixing Instructions, and then try again.
    
    Setting Type
    Configuration Item
    Description
    Task Configuration
    Task Name
    Set a business-significant name for easy task identification.
    Running Mode
    Immediate execution: Start a task immediately after passing task verification.
    Scheduled execution: Set a task execution time, and the task will start when the time is reached.
    Tag
    Tags are used to manage resources by category from different dimensions. If the existing tags do not meet your requirements, go to the console to manage the tags.
    Source Database Settings
    Source Database Type
    The source database type selected at the time of purchase, which cannot be modified.
    Region
    The source database region selected at the time of purchase, which cannot be modified.
    Access Type
    Choose according to your scenario. This example uses "Database". For preparation work for different access types, refer to Overview of Preparations Related to Network.
    To ensure migration efficiency, cross-region migration is not supported for self-built instances on CVM. If cross-region migration is needed, choose the public network access method.
    Public Network: The source database can be accessed via a public IP address. When migrating via the public network, ensure that the source instance service is accessible under the public network environment and that the public network connection remains stable. Network fluctuations or failures may cause the migration to fail. If the migration fails, a new migration task will need to be initiated.
    Self-Build on CVM: The source database is deployed on a Tencent CVM. To ensure migration efficiency, cross-region migration is not supported for self-built instances on CVM. If cross-region migration is needed, choose the public network access method.
    Direct Connect: The source database can be connected to Tencent Virtual Private Cloud via Direct Connect.
    VPN Access: The source database can be connected to Tencent Virtual Private Cloud via VPN Connections.
    Database: The source database is a TencentDB instance.
    CCN: The source database can be connected to Tencent Virtual Private Cloud via Cloud Connect Network.
    Cross-/Intra-Account
    Intra-account: The source database instance and the target database instance belong to the same Tencent Cloud root account.
    Cross-account: The source database instance and the target database instance belong to different Tencent Cloud root accounts. The following is an example of migration within the same account. For cross-account migration guidance, refer to Cross-Account TencentDB Instance Migration.
    Database Instance
    Select the instance ID of the source PostgreSQL database.
    Account
    The account of the source PostgreSQL database, which must have the required permissions.
    Password
    The password of the source PostgreSQL database account.
    Target Database Settings
    Target Database Type
    The target database type selected at the time of purchase, which cannot be modified.
    Region
    The target database region selected at the time of purchase, which cannot be modified.
    Access Type
    Choose according to your scenario. This example uses "Database" by default.
    Database Instance
    Select the instance ID of the target database.
    Account
    The account of the target database, which must have the required permissions.
    Password
    The password of the target database account.
    5. On the Set migration options and select migration objects page, configure the migration type and objects and click Save.
    
    Configuration Item
    Description
    Migration Type
    Choose according to your scenario.
    Structural migration: Migrate structured data such as databases and tables.
    Full migration: Migrate the entire database. The migrated data includes only the existing data of the source database when a task is initiated and does not include the incremental data written to the source database after a task is initiated.
    Full + Incremental migration: The migrated data includes the existing data of the source database when a task is initiated as well as the incremental data written to the source database after a task is initiated. If data is being written to the source database during migration, and you want to smoothly migrate the data in a non-stop manner, select this option.
    Migration Object
    Entire instance: Migrate the entire instance, excluding system databases such as system objects in PostgreSQL. However, roles and user metadata definitions will be migrated.
    Specify object: Migrate specified objects.
    Specify object
    Select the objects to be migrated in Source Database Object and move them to the Selected Object box.
    6. On the task verification page, verify the task. After the task passes verification, click Start Task. If the verification fails, refer to Verification Failure Handling to fix the issues and then reinitiate the verification task.
    Failed: indicates that a verification item failed the check, the task is blocked, and you need to fix the issue and execute the verification task again.
    Warning: indicates that a verification item does not fully meet the requirements but the task can proceed, impacting the business to some extent. You need to decide based on the prompt whether to ignore the warning or fix the issue and continue.
    
    7. Return to the data migration task list. The task enters the Ready to Run state. After 1 to 2 minutes, the data migration task will officially start.
    Select Structural migration or Full migration: Once completed, the task will automatically end without manual intervention.
    Select Full + Incremental migration: After full migration is completed, the migration task will automatically enter the incremental data synchronization phase, which will not stop automatically. You need to manually click Complete to stop the incremental data synchronization. After you click Complete, the task enters the In Progress state. Do not make any changes to the source end or the target end as the backend will automatically align some objects with the source end.
    Manually complete incremental data synchronization and business cutover at appropriate time.
    When a migration task is in the incremental synchronization phase without any latency, stop writing data to the source database for a few minutes.
    Manually complete incremental synchronization when the data gap between the target and the source databases is 0 MB and the time latency between them is 0 seconds.
    
    8. (Optional) If you need to view tasks, delete tasks, and perform other operations, click the corresponding task and select an action in the Operation column. For details, see Task Management.
    9. When the migration task status changes to Task successful, you can proceed with the official business cutover. For more details, refer to Cutover Description.
    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