All Products
Search
Document Center

Data Transmission Service:AnalyticDB for PostgreSQL to Message Queue for Kafka

Last Updated:Aug 27, 2026

You can use DTS to stream data from AnalyticDB for PostgreSQL instances to Message Queue for Apache Kafka.

Note

This feature is in beta testing. To use it, please Submit a ticket to request access.

Scope

  • You must create a topic in the target Message Queue for Apache Kafka instance to receive synchronized data. For more information, see Step 1: Create a topic.

  • The target Message Queue for Apache Kafka instance must have more storage space than is used by the source AnalyticDB for PostgreSQL instance.

Usage notes

Source restrictions

Type

Limits

Before synchronization

  • Bandwidth requirements: To ensure synchronization speed, make sure the outbound bandwidth of the source database server is at least 100 Mb/s.

  • Kernel version: The kernel version of the source AnalyticDB for PostgreSQL instance must be 7.2.1.4 or later.

  • Parameter settings:

    • Logical replication: Enable logical replication. Set the wal_level parameter to logical.

    • High-availability settings: If the source instance is a High-availability Edition, set the hot_standby, hot_standby_feedback, and sync_replication_slots parameters to on to prevent synchronization interruptions during a primary/standby switchover.

  • Account permissions: The synchronization account must have read permissions on the objects to be synchronized and the REPLICATION permission. To grant this permission, run the command: ALTER USER your_user WITH REPLICATION;.

  • Impact of long-running transactions: During incremental synchronization, uncommitted long-running transactions in the source database can cause the write-ahead log (WAL) to accumulate and fill up the disk space.

  • Object limits:

    • Naming conventions: The name of the database to be synchronized cannot contain a hyphen (-), such as dts-testdata.

    • Primary key or UNIQUE constraint: Tables to be synchronized must have a primary key or a UNIQUE constraint. The values in the constrained fields must be unique. Otherwise, duplicate data may appear in the destination database.

    • Partitioned tables: The structure of partitioned tables cannot be synchronized. After a partitioned table is synchronized, its partition information is lost. The table is created as a non-partitioned table in the destination database by default.

    • Number of databases per task: A single sync task can synchronize only one database. To synchronize multiple databases, create a separate sync task for each database.

    • Task configuration scale: To edit more than 5,000 tables in a task, such as for column name mapping, create multiple tasks in batches or configure synchronization for the entire database. This helps avoid request errors when you submit the task.

    • Unsupported object types: DTS does not support synchronizing tables that inherit across schemas, temporary tables, internal system triggers, some functions (C-language and internal functions for PROCEDURE and FUNCTION), and extensions (EXTENSION).

    • Supported object types: DTS supports synchronizing primary keys, UNIQUE constraints, CHECK constraints, and some custom data types (COMPOSITE, ENUM, and RANGE).

During synchronization

  • DDL operation limits: During the schema synchronization and full synchronization phases, do not perform DDL operations that change the database or table structure. Otherwise, the data synchronization task fails.

    Note

    During the full synchronization phase, DTS queries the source database. This creates a metadata lock, which can block DDL operations on the source database.

  • DDL synchronization support: DTS does not currently support synchronizing DDL operations from the source database. After a DTS task starts, new tables created in the source and their subsequent data changes are not synchronized to the destination. If needed, create a new sync task.

  • Connection information changes: While the task is running, do not change the connection address or zone of the AnalyticDB for PostgreSQL instance. Otherwise, the sync task fails.

Destination restrictions

Type

Limits

Before synchronization

  • Performance impact assessment: Full synchronization consumes read and write resources on both the source and destination databases, which can increase the database load. Run sync tasks during off-peak hours, for example, when the CPU load is below 30%.

  • Single message size: Kafka limits the size of a single message to 10 MB. If a single row of data from the source database exceeds this limit after transformation, the task is interrupted. When you configure the task, filter out columns that contain large objects. If the task is already running, modify the synchronization objects. Remove the table, then add it back and filter out the columns with large objects to prevent them from being synchronized.

During synchronization

  • Destination cluster scaling: If the destination Kafka cluster is scaled out or in while the task is running, such as by adding or removing broker nodes, you must restart the DTS sync task for the changes to take effect.

  • External data writes: To ensure data consistency, do not write data from outside the DTS task to the destination Kafka cluster during synchronization. This can cause data inconsistency or task failure.

  • Storage space growth: During full synchronization, DTS performs concurrent write operations, which can cause data fragmentation at the destination. After synchronization, the storage space used at the destination might be larger than at the source.

  • Task restart behavior: For tasks that include both full and incremental synchronization, restarting the task might re-run the full synchronization phase.

  • Instance failure:

    • Recovery mechanism: DTS helpdesk will try to recover the instance within 8 hours. During recovery, the instance might be restarted or the DTS task parameters might be adjusted. Your database parameters will not be modified.

    • Data overwrite risk: After you switch your business to the destination database, promptly stop or release sync tasks that are no longer needed. This prevents accidental data overwrites in the destination database caused by automatic recovery.

Supported synchronization SQL

INSERT, UPDATE, and DELETE.

Supported synchronization objects

  • Basic objects: SCHEMA, TABLE

    Note

    Includes PRIMARY KEY, UNIQUE KEY, DATATYPE (built-in data types), and DEFAULT CONSTRAINT.

  • Other objects: VIEW, INDEX, PROCEDURE, FUNCTION, RULE, SEQUENCE, AGGREGATE, OPERATOR, and DOMAIN.

Pricing

Synchronization type

Fees

Schema synchronization and full synchronization

Free.

Incremental synchronization

Fees apply. See billing overview.

Procedure

  1. Go to the data synchronization task list page in the destination region. You can do this in one of two ways.

    DTS console

    1. Log on to the DTS console.

    2. In the navigation pane on the left, click Data Synchronization.

    3. In the upper-left corner of the page, select the region where the synchronization instance is located.

    DMS console

    Note

    The actual steps may vary depending on the mode and layout of the DMS console. For more information, see Simple mode console and Customize DMS console layout and style.

    1. Log on to the DMS console.

    2. In the top menu bar, choose Data + AI > DTS (DTS) > Data Synchronization.

    3. To the right of Data Synchronization Tasks, select the region of the synchronization instance.

  2. Click Create Task to navigate to the task configuration page.

  3. Configure the source and destination databases.

    Category

    Parameter

    Description

    N/A

    Task Name

    DTS automatically generates a task name. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.

    Source Database

    Select Existing Connection

    • Select the registered database instance with DTS from the drop-down list. The database information below is automatically configured.

      Note

      In the DMS console, this configuration item is Select a DMS database instance.

    • If you have not registered the database instance or do not need to use a registered instance, manually configure the database information below.

    Database Type

    Select AnalyticDB for PostgreSQL.

    Access Method

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region of the source AnalyticDB for PostgreSQL instance.

    Replicate Data Across Alibaba Cloud Accounts

    In this example, data is synchronized within the same Alibaba Cloud account. Select No.

    Instance ID

    Select the instance ID of the source AnalyticDB for PostgreSQL instance.

    Database Name

    Enter the name of the source database to synchronize.

    Database Account

    Enter the database account of the source AnalyticDB for PostgreSQL instance. The account must have read permissions on the objects to synchronize.

    Database Password

    Enter the password for the specified database account.

    Destination Database

    Select Existing Connection

    • Select the registered database instance with DTS from the drop-down list. The database information below is automatically configured.

      Note

      In the DMS console, this configuration item is Select a DMS database instance.

    • If you have not registered the database instance or do not need to use a registered instance, manually configure the database information below.

    Database Type

    Select Kafka.

    Access Method

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region of the target Message Queue for Apache Kafka instance.

    Kafka Instance ID

    Select the instance ID of the target Message Queue for Apache Kafka instance.

    Encryption

    Based on your business and security requirements, select Non-encrypted or SCRAM-SHA-256.

    Topic

    Select the topic to receive the synchronized data.

    Use Kafka Schema Registry

    Kafka Schema Registry provides a RESTful interface for storing and retrieving Avro schemas.

    • No: Does not use Kafka schema registry.

    • Yes: Uses Kafka schema registry. You must enter the URL or IP address where the Avro schema is registered in Kafka schema registry.

  4. After completing the configuration, click Test Connectivity and Proceed at the bottom of the page.

    Note
    • Ensure that you add the CIDR blocks of the DTS servers (either automatically or manually) to the security settings of both the source and destination databases to allow access. For more information, see Add the IP address whitelist of DTS servers.

    • If the source or destination is a self-managed database (i.e., the Access Method is not Alibaba Cloud Instance), you must also click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

  5. Configure the task objects.

    1. On the Configure Objects page, specify the objects to synchronize.

      Parameter

      Description

      Synchronization Types

      DTS always selects Incremental Data Synchronization. By default, you must also select Schema Synchronization and Full Data Synchronization. After the precheck, DTS initializes the destination cluster with the full data of the selected source objects, which serves as the baseline for subsequent incremental synchronization.

      Note

      When the Access Method for the target Kafka instance is set to Alibaba Cloud Instance, Schema Synchronization is not supported.

      Processing Mode of Conflicting Tables

      • Precheck and Report Errors: Checks for tables with the same names in the destination database. If any tables with the same names are found, an error is reported during the precheck and the data synchronization task does not start. Otherwise, the precheck is successful.

        Note

        If you cannot delete or rename the table with the same name in the destination database, you can map it to a different name in the destination. For more information, see Object name mapping.

      • Ignore Errors and Proceed: Skips the check for tables with the same name in the destination database.

        Warning

        Selecting Ignore Errors and Proceed may cause data inconsistency and put your business at risk. For example:

        • If the table schemas are consistent and a record in the destination database has the same primary key or unique key value as a record in the source database:

          • During full data synchronization, DTS retains the destination record and skips the source record.

          • During incremental synchronization, DTS overwrites the destination record with the source record.

        • If the table schemas are inconsistent, data initialization may fail. This can result in only partial data synchronization or a complete synchronization failure. Use with caution.

      Data Format in Kafka

      Select the format for storing data synchronized to the Kafka instance.

      Kafka Data Compression Format

      Select a compression format for Kafka messages.

      • LZ4 (Default): Low compression ratio, high compression speed.

      • GZIP: High compression ratio, low compression speed.

        Note

        This format has high CPU overhead.

      • Snappy: Medium compression ratio, medium compression speed.

      Policy for Shipping Data to Kafka Partitions

      Select a strategy based on your business requirements.

      Message acknowledgement mechanism

      Select a message acknowledgment mechanism based on your business requirements.

      Topic That Stores DDL Information

      Select the topic for storing DDL information.

      Note

      If you do not select a topic, DDL information is stored in the data-receiving topic by default.

      Capitalization of Object Names in Destination Instance

      Configure the case-sensitivity policy for database, table, and column names in the destination instance. By default, the DTS default policy is selected. You can also choose to use the default policy of the source or destination database. For more information, see Case policy for destination object names.

      Source Objects

      In the Source Objects box, click the objects, and then click 向右 to move them to the Selected Objects box.

      Note

      You can select objects at the table level.

      Selected Objects

      No additional configuration is required. You can use the mapping feature to set the topic name, number of topic partitions, or column names for the source table in the target Kafka instance.

      Kafka object information

      1. In the Selected Objects area, hover over the target topic name (at the table level).

      2. Click Edit next to the topic name.

      3. In the Edit Table dialog box, configure the mapping information.

        Note
        • At the schema level, use the Edit Schema dialog box, which has fewer parameters. At the table level, use the Edit Table dialog box.

        • If you are not synchronizing an entire schema, you cannot modify the Name of target Topic and Number of Partitions settings in the Edit Schema dialog box.Destination Database Name

        Parameter

        Description

        Name of target Topic

        The name of the destination topic to which the source table is synchronized. The default value is the Topic selected in the Destination Database section of the Configurations for Source and Destination Databases step.

        Important
        • For an Alibaba Cloud Message Queue for Apache Kafka instance, the topic must already exist. Otherwise, the data synchronization task fails. If the target is a self-managed Kafka cluster and the synchronization task includes schema synchronization, DTS attempts to create the topic you specify.

        • If you modify the Name of target Topic, DTS writes data to the new topic.

        Filter Conditions

        For more information, see Set Filter Conditions.

        Number of Partitions

        The number of partitions to use when writing data to the target topic.

        Column

        Specifies the column names for data written to the target topic.

      Note
      • To select the SQL operations to be synchronized at the schema or table level, right-click the object in the Selected Objects pane and select the desired SQL operations in the dialog box that appears.

      • If you use the object name mapping feature, other objects that depend on the mapped object may fail to be synchronized.

    2. Click Next: Advanced Settings.

      Parameter

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS uses a shared cluster for tasks, so you do not need to make a selection. For greater task stability, you can purchase a dedicated cluster to run the DTS synchronization task. For more information, see What is a DTS dedicated cluster?.

      Enable Encryption of Data In-Transit?

      Encrypted data transmission may affect synchronization performance. Enable this feature based on your security requirements.

      • No (Default)

      • Yes

      Retry Time for Failed Connections

      If the connection to the source or destination database fails after the synchronization task starts, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1,440 minutes. We recommend a duration of 30 minutes or more. If the connection is restored within this period, the task resumes automatically. Otherwise, the task fails.

      Note
      • If multiple DTS instances (e.g., Instance A and B) share a source or destination, DTS uses the shortest configured retry duration (e.g., 30 minutes for A, 60 for B, so 30 minutes is used) for all instances.

      • DTS charges for task runtime during connection retries. Set a custom duration based on your business needs, or release the DTS instance promptly after you release the source/destination instances.

      Retry Time for Other Issues

      If a non-connection issue (e.g., a DDL or DML execution error) occurs, DTS reports an error and immediately retries the operation. The default retry duration is 10 minutes. You can also customize the retry time to a value from 1 to 1,440 minutes. We recommend a duration of 10 minutes or more. If the related operations succeed within the set retry time, the synchronization task automatically resumes. Otherwise, the task fails.

      Important

      The value of Retry Time for Other Issues must be less than that of Retry Time for Failed Connections.

      Enable Throttling for Full Data Synchronization

      During full data synchronization, DTS consumes read and write resources from the source and destination databases, which can increase their load. To mitigate pressure on the destination database, you can limit the migration rate by setting Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s).

      Note

      Enable Throttling for Incremental Data Synchronization

      You can also limit the incremental synchronization rate to reduce pressure on the destination database by setting RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s).

      Environment Tag

      You can select an environment tag to identify the instance as needed. This example does not require a selection.

      Scene Label

      You can select a scenario tag to identify the use case of the instance as needed. The scenario tag does not affect the normal operation of the task. This example does not require a selection.

      Configure ETL

      Choose whether to enable the extract, transform, and load (ETL) feature. For more information, see What is ETL? Valid values:

      Monitoring and Alerting

      Choose whether to set up alerts. If the synchronization fails or the latency exceeds the specified threshold, DTS sends a notification to the alert contacts.

  6. Save the task and perform a precheck.

    • To view the parameters for configuring this instance via an API operation, hover over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the tooltip.

    • If you have finished viewing the API parameters, click Next: Save Task Settings and Precheck at the bottom of the page.

    Note
    • Before a synchronization task starts, DTS performs a precheck. You can start the task only if the precheck passes.

    • If the precheck fails, click View Details next to the failed item, fix the issue as prompted, and then rerun the precheck.

    • If the precheck generates warnings:

      • For non-ignorable warning, click View Details next to the item, fix the issue as prompted, and run the precheck again.

      • For ignorable warnings, you can bypass them by clicking Confirm Alert Details, then Ignore, and then OK. Finally, click Precheck Again to skip the warning and run the precheck again. Ignoring precheck warnings may lead to data inconsistencies and other business risks. Proceed with caution.

  7. Purchase the instance.

    1. When the Success Rate reaches 100%, click Next: Purchase Instance.

    2. On the Purchase page, select the billing method and link specifications for the data synchronization instance. For more information, see the following table.

      Category

      Parameter

      Description

      New Instance Class

      Billing Method

      • Subscription: You pay upfront for a specific duration. This is cost-effective for long-term, continuous tasks.

      • Pay-as-you-go: You are billed hourly for actual usage. This is ideal for short-term or test tasks, as you can release the instance at any time to save costs.

      Resource Group Settings

      The resource group to which the instance belongs. The default is default resource group. For more information, see What is resource management?.

      Instance Class

      DTS offers synchronization specifications at different performance levels that affect the synchronization rate. Select a specification based on your business requirements. For more information, see Data synchronization link specifications.

      Subscription Duration

      In subscription mode, select the duration and quantity of the instance. Monthly options range from 1 to 9 months. Yearly options include 1, 2, 3, or 5 years.

      Note

      This option appears only when the billing method is Subscription.

    3. Read and select the checkbox for Data Transmission Service (Pay-as-you-go) Service Terms.

    4. Click Buy and Start, and then click OK in the OK dialog box.

      You can monitor the task progress on the data synchronization page.

FAQ