This guide covers how to create and manage a disaster recovery (DR) instance for ApsaraDB RDS for PostgreSQL. The example uses a self-managed PostgreSQL instance deployed on an Elastic Compute Service (ECS) instance as the source, and an RDS instance as the destination DR instance.
Prerequisites
Before you begin, ensure that you have:
Completed all preparation steps for creating a DR instance. See Prepare to create a DR instance
Usage notes
Creating a DR instance may trigger read and write operations on the source instance, increasing its workload. Avoid running instance migrations or restarts during this process.
Create a DR instance
Creating a DR instance requires two sequential steps: a feasibility assessment, followed by creating a DR deployment task. You can only proceed to the second step after the assessment succeeds.
Step 1: Run a feasibility assessment
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where the RDS instance resides, find the instance, and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. On the Feasibility assessment tab, configure the assessment.
Set Scenario to DR Construction and Source to Self-managed Instance or Other Instance. Click Next.
Confirm the destination instance configuration and click Next.
In the Configure Source Database step, select all listed items and click Next.
Before proceeding, complete the source instance preparations and configuration. See Prepare to create a DR instance and Configure the source instance.
In the Start Feasibility Assessment step, enter the source instance information.
Parameter Description DR Construction Task Name The name of the DR deployment task. The system generates a name automatically. No modification is needed. IP Address/Domain Name of Source Instance The public endpoint of the source instance. Port of Source Instance The port of the source instance. Run netstat -a | grep PGSQLto find it.Username The account used to create the DR relationship. For example, replicatoraccount.Password The password of the account used to create the DR relationship. Click Create Feasibility Assessment Task. In the DR Construction section, monitor the assessment status:
Successful: Proceed to Step 2.
Failed: Click View Report in the Actions column to review the errors. For details on common errors, see Analyze a DR feasibility assessment report.
While the assessment runs, the destination RDS instance status changes to Maintaining Instance.
Step 2: Create a DR deployment task
Complete this step only after the feasibility assessment status is Successful.
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where the RDS instance resides, find the instance, and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. Go to the DR Construction tab.
Click Create DR Relationship.
In the Create DR Relationship dialog box, select the successful feasibility assessment task.
Click Create DR Relationship.
The task appears in the task list on the DR Construction tab. To track progress:
Click the Construction Phase column to view the phases required to complete the task.
When Incremental Data Synchronization appears in the Construction Phase column, the DR deployment task is complete.
Click View Logs in the Actions column to view task log details.
Manage a DR instance
Rebuild a DR relationship
If synchronization between the source instance and the DR instance is interrupted or delayed, rebuild the DR relationship to restore normal synchronization.
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where the RDS instance resides, find the instance, and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. Go to the DR Construction tab.
Click Reconstruct DR Relationship.
Promote the DR instance
When the source instance fails, promote the DR instance to a new primary instance so that read and write requests can be processed as expected and helps implement high availability.
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where the RDS instance resides, find the instance, and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. Go to the DR Construction tab.
Click Promote DR Instance.