Synchronize PolarDB-X to AnalyticDB for PostgreSQL

更新时间:
复制 MD 格式

AnalyticDB for PostgreSQL (formerly HybridDB for PostgreSQL) is a simple, fast, and cost-effective petabyte-scale cloud data warehouse solution. You can use Data Transmission Service (DTS) to synchronize data from PolarDB-X to AnalyticDB for PostgreSQL. This allows you to quickly perform ad-hoc query and analysis, ETL processing, and visual exploration on large volumes of data.

Prerequisites

  • The databases in your PolarDB-X instance must be created on ApsaraDB RDS for MySQL.

  • The source tables to be synchronized must have a primary key.

  • You have an AnalyticDB for PostgreSQL instance. For more information, see Create an AnalyticDB for PostgreSQL instance.

Precautions

  • During initial full data synchronization, DTS consumes read and write resources from the source and destination databases, which increases the database load. If database performance is poor, instance specifications are low, or business traffic is heavy (for example, the source database has many slow SQL queries or tables without primary keys, or the destination database experiences deadlocks), the database load increases and may even cause the service to become unavailable. Before you synchronize data, evaluate the performance of your source and destination instances. We recommend performing data synchronization during off-peak hours, for example, when the CPU utilization of both instances is below 30%.

  • During data synchronization, do not perform operations such as scaling, migrating hot tables, changing sharding keys, or executing DDL statements on the PolarDB-X instance. These operations can cause the data synchronization task to fail.

  • If you need to change the network type of a PolarDB-X instance during data synchronization, you must update the task's network connection information afterward.

  • If you create a new source table to synchronize after the task has started, you must add it as a synchronization object to the task.

  • The source PolarDB-X instance must be version 5.2 or later. For information about how to view the instance version, see Instance version overview.

Billing

Synchronization type

Pricing

Schema synchronization and full data synchronization

Free of charge.

Incremental data synchronization

Charged. For more information, see Billing overview.

Limitations

  • DTS supports only table-level data synchronization. You cannot use append-optimized (AO) tables as destination tables.

  • DTS does not support synchronizing data of the following types: JSON, GEOMETRY, CURVE, SURFACE, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION.

Supported SQL operations

INSERT, UPDATE, and DELETE.

Term mappings

PolarDB-X

AnalyticDB for PostgreSQL

Database

Schema

Table

Table

Procedure

  1. Purchase a data synchronization task. For more information, see Purchase a DTS instance.

    Note

    When purchasing the task, set the source instance to PolarDB-X (upgraded from DRDS), the destination instance to AnalyticDB for PostgreSQL, and the synchronization topology to One-way Synchronization.

  2. Log on to the DTS console.

    Note

    If you are automatically redirected to the Data Management (DMS) console, you can click the jiqiren icon in the lower-right corner and then click 返回旧版 to return to the classic DTS console.

  3. In the left-side navigation pane, click Data Synchronization.

  4. At the top of the Synchronization Tasks page, select the region where your destination instance is located.

  5. Find the data synchronization task that you purchased and click Configure Task.

  6. Configure the source and destination instances for the synchronization task.

    Category

    Parameter

    Description

    N/A

    Synchronization task name

    DTS automatically generates a task name. We recommend using a descriptive name for easier identification. The name does not have to be unique.

    Source instance information

    Instance type

    This parameter is fixed to DRDS Instance.

    Instance region

    The region of the source instance you selected during purchase. This parameter cannot be changed.

    DRDS instance ID

    Select the ID of the PolarDB-X instance.

    Destination instance information

    Instance type

    This parameter is fixed to AnalyticDB for PostgreSQL.

    Instance region

    The region of the destination instance you selected during purchase. This parameter cannot be changed.

    Instance ID

    Select the ID of the AnalyticDB for PostgreSQL instance.

    Database name

    Enter the name of the destination database in the AnalyticDB for PostgreSQL instance.

    Database account

    Enter the database account for the AnalyticDB for PostgreSQL instance.

    Database password

    Enter the password for the database account.

  7. In the lower-right corner of the page, click Set Whitelist and Next.

    If the source or destination database is an Alibaba Cloud database instance, such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance, DTS automatically adds the CIDR blocks of DTS servers to the IP address whitelist of the instance. If the source or destination database is a self-managed database hosted on an Elastic Compute Service (ECS) instance, DTS automatically adds the CIDR blocks of DTS servers to the security group rules of the ECS instance, and you must make sure that the ECS instance can access the database. If the self-managed database is hosted on multiple ECS instances, you must manually add the CIDR blocks of DTS servers to the security group rules of each ECS instance. If the source or destination database is a self-managed database that is deployed in a data center or provided by a third-party cloud service provider, you must manually add the CIDR blocks of DTS servers to the IP address whitelist of the database to allow DTS to access the database. For more information, see Whitelist DTS server IP addresses.

    Warning

    Adding the public IP address blocks of the DTS service, either automatically or manually, may pose security risks. Using this product, you acknowledge that you understand and accept the potential security risks and that you must implement basic security measures. These measures include, but are not limited to, strengthening password security, limiting the ports open to each CIDR block, using authentication for internal API calls, and regularly checking and restricting unnecessary CIDR blocks. Alternatively, you can connect through a private network using a leased line, VPN Gateway, or Smart Access Gateway.

  8. Configure the synchronization policy and objects.

    Category

    Parameter

    Description

    Synchronization policy configuration

    Synchronization initialization

    By default, you must select both Schema initialization and Full data initialization. After the precheck is passed, DTS initializes the schema and data of the selected objects in the destination instance. This provides a baseline for subsequent incremental data synchronization.

    Processing mode for existing destination table

    • Clear data in destination table

      Skips the Destination table is empty check item during the precheck phase. Before full initialization, clear the data from the destination table. This is suitable for production synchronization after you have tested the synchronization task.

    • Ignore Errors and Proceed

      Skips the Whether the target table is empty check item in the precheck phase. During full data initialization, synchronized data is directly appended. This is suitable for scenarios where you need to aggregate data from multiple tables into a single table.

    Synchronization operation type

    Select the operation types to synchronize based on your business requirements:

    • Insert

    • Update

    • Delete

    Select synchronization objects

    N/A

    In the Source Objects box, select the tables you want to synchronize, and then click the 向右小箭头 icon to move them to the Selected Objects box.

    Note
    • You can only select tables as synchronization objects.

    • If you want to map to a destination table with a different column structure, use the DTS field mapping feature. For more information, see Set object names in the destination instance.

    Map object names

    N/A

    Change the names of synchronized objects in the destination instance. For more information, see Map databases, tables, and columns.

    Important

    If you use column mapping for partial table synchronization or when the source and destination table schemas are inconsistent, you will lose data from any source columns that do not have a corresponding destination column.

    Connection retry duration

    N/A

    If DTS cannot connect to the source or destination instance, it retries for 720 minutes (12 hours) by default. You can also specify a custom retry duration. If DTS reconnects to the source or destination instance within the specified duration, the synchronization task automatically resumes. Otherwise, the task fails.

    Note

    You are billed for task run time during connection retries. Customize the retry duration based on your business needs, or release the DTS instance as soon as the source and destination instances are released.

  9. After completing these configurations, click Next in the lower-right corner of the page.

  10. Specify the primary key and distribution columns for the tables to be synchronized in the AnalyticDB for PostgreSQL instance.

    The configuration page displays the Schema, Table, Primary key column, Distribution column, and Definition status of the tables to be synchronized. For example, for the mysqltest.customer table, you can set both the primary key column and the distribution column to id. The definition status then changes to Defined. After completing the settings, click Precheck and Start.

    Note

    This page appears only if you selected Schema initialization in Step 8. For more information about primary key columns and distribution columns, see Define table constraints and Define table distribution keys.

  11. After completing the preceding configurations, click Precheck and Start in the lower-right corner of the page.

    Note
    • A precheck runs before the synchronization task starts, and you can only start the task after it passes.

    • If the precheck fails, click the 提示 icon next to the failed item to view the details.

      • You can fix the issues based on the cause and run the precheck again.

      • If you do not need to fix the items that triggered warnings, you can click Ignore or Ignore Warnings and Rerun Precheck to skip the warnings and run the precheck again.

  12. After the Precheck dialog box displays Precheck Passed, close the Precheck dialog box. The synchronization task starts automatically.

  13. Wait for the task to finish initialization and enter the Synchronizing state.

    You can view the status of the data synchronization task on the Data Synchronization page.