This topic describes how to use the cloud migration feature to migrate data from a self-managed PostgreSQL instance that resides on an Elastic Compute Service (ECS) instance or in a data center to an ApsaraDB RDS for PostgreSQL instance. The cloud migration feature of ApsaraDB RDS for PostgreSQL uses physical streaming replication to help you migrate data to the cloud in an easy-to-use, efficient manner and at a high speed with no downtime. This feature is suitable in all scenarios.
Prerequisites
- The RDS instance meets the following requirements:
- The RDS instance and the self-managed PostgreSQL instance run the same PostgreSQL
version, which can be PostgreSQL 10, PostgreSQL 11, PostgreSQL 12, PostgreSQL 13,
or PostgreSQL 14.
Note If you want to migrate data from an instance that runs PostgreSQL 10 to an RDS instance that runs PostgreSQL 13, you must use the cloud migration feature to migrate the data from the source PostgreSQL instance to an RDS instance that runs PostgreSQL 10 and then upgrade the major engine version of the RDS instance to PostgreSQL 13 based on the descriptions in Upgrade the major engine version of an ApsaraDB RDS for PostgreSQL instance.
- The RDS instance is a primary instance. Read-only RDS instances do not support cloud migration.
- The RDS instance is equipped with standard SSDs or enhanced SSDs (ESSDs).
- The RDS instance is empty. The available storage of the RDS instance is greater than or equal to the size of the data in the self-managed PostgreSQL instance.
- The RDS instance does not use a new general-purpose instance type.
Note The new general-purpose instance types provide better scalability and performance and reduce the time to create an RDS instance or change the specifications of an RDS instance. The new general-purpose instance types do not support the cloud migration feature. For more information, see Primary ApsaraDB RDS for PostgreSQL instance types.
- The RDS instance and the self-managed PostgreSQL instance run the same PostgreSQL
version, which can be PostgreSQL 10, PostgreSQL 11, PostgreSQL 12, PostgreSQL 13,
or PostgreSQL 14.
- The self-managed PostgreSQL instance meets the following requirements:
- Networking
Migration source Network configuration Self-managed ECS-based PostgreSQL Database or ApsaraDB RDS for PostgreSQL Instance If the self-managed PostgreSQL instance resides on an ECS instance, the ECS instance and the destination RDS instance must reside in the same virtual private cloud (VPC). If the source instance is an RDS instance, the source RDS instance and the destination RDS instance must reside in the same VPC. If the source instance and the destination RDS instance reside in different VPCs, you must use Cloud Enterprise Network (CEN) to connect the VPCs. For more information, see What is CEN? Self-managed PostgreSQL database in a data center (within the same VPC as the destination database) The data center must be able to communicate with the VPC to which the destination RDS instance belongs. For more information, see Connect a data center to a VPC. PostgreSQL migration with public network address (including migrating from other cloud vendors) The source PostgreSQL instance is assigned with a public IP address. Note The source PostgreSQL instance from other cloud service providers can be a self-managed PostgreSQL instance in the cloud or a managed PostgreSQL instance, such as a Google Cloud SQL instance or an Amazon RDS for PostgreSQL instance. - If the self-managed PostgreSQL instance resides on an ECS instance, an ECS security group is configured. For more information, see (Optional) Configure an ECS security group on a self-managed PostgreSQL instance.
- The configurations that are described in Configure the postgresql.conf file of a self-managed PostgreSQL instance are complete.
- The configurations that are described in Create an account for cloud migration on a self-managed PostgreSQL instance are complete.
- The configurations that are described in Update the pg_hba.conf file of a self-managed PostgreSQL instance are complete.
- The configurations that are described in Configure the firewall of the server on which a self-managed PostgreSQL instance resides are complete.
- Networking
Usage notes
During the cloud migration, you can read data from and write data to the self-managed PostgreSQL instance. However, do not perform operations such as migration, restart, or specification changes on the self-managed PostgreSQL instance.