This topic describes how to synchronize data from an ApsaraDB RDS for PostgreSQL instance to an AnalyticDB for PostgreSQL instance by using Data Transmission Service (DTS). The data synchronization feature provided by DTS allows you to transfer and analyze data with ease.
Prerequisites
- The tables to synchronize from the ApsaraDB RDS for PostgreSQL instance contain primary keys.
- The destination AnalyticDB for PostgreSQL instance is created. For more information, see Create an instance.
Precautions
- A single data synchronization task can synchronize data from only one database. To synchronize data from multiple databases, you must create a data synchronization task for each database.
- During data synchronization, new tables that are created in the source database can
also be synchronized. However, to ensure data consistency, you must execute the following
statement on the new tables before they can be synchronized:
ALTER TABLE schema.table REPLICA IDENTITY FULL;
- To ensure that the data synchronization task runs as expected, you can perform primary/secondary
switchover only on an ApsaraDB RDS for PostgreSQL instance V11. In this case, you
must set the
rds_failover_slot_mode
parameter tosync
. For more information, see Logical Replication Slot Failover.Warning If you perform primary/secondary switchover on a self-managed PostgreSQL database or an ApsaraDB RDS for PostgreSQL instance of other versions, the data synchronization task stops.
Limits
- Initial schema synchronization is not supported. DTS does not synchronize the schemas of the required objects from the source database to the destination database.
- You can select only tables as the objects to synchronize.
- DTS does not synchronize the following types of data: BIT, VARBIT, GEOMETRY, ARRAY, UUID, TSQUERY, TSVECTOR, and TXID_SNAPSHOT.
- If you perform a DDL operation on an object to be synchronized in the source database during data synchronization, you must perform the operation in the destination database. Then, you must restart the data synchronization task.
SQL operations that can be synchronized
INSERT, UPDATE, and DELETE