This topic describes how to use the disaster recovery (DR) deployment feature of ApsaraDB RDS for PostgreSQL to create an ApsaraDB RDS for PostgreSQL instance for a source instance to implement DR. In this topic, the self-managed PostgreSQL instance that is deployed on an Elastic Compute Service (ECS) instance is used as the source instance. The RDS instance is referred to as the destination DR instance.
Prerequisites
The preparations that are required to create a DR instance are complete. For more information, see Prepare to create a DR instance.
Usage notes
When you create a DR instance, read and write operations may be performed on the source instance. This increases workloads on the source instance. We recommend that you do not perform operations such as instance migration or restart.
Create a DR instance
Step 1: Start feasibility assessment
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. On the page that appears, click the Feasibility assessment tab.
Set the Scenario parameter to DR Construction and the Source parameter to Self-managed Instance or Other Instance. Click Next.
Confirm the configurations of the destination instance and click Next.
In the Configure Source Database step of the configuration wizard, select all listed items and click Next.
NoteYou must complete the preparations for creating a DR instance and configure the source instance. For more information, see Prepare to create a DR instance and Configure the source instance.
In the Start Feasibility Assessment step of the configuration wizard, configure the information about the source instance. The following table describes the parameters.
Parameter
Description
DR Construction Task Name
The name of the DR deployment task. The system automatically generates a name for the DR deployment task. You do not need to modify the generated name.
IP Address/Domain Name of Source Instance
The public endpoint of the source instance.
Port of Source Instance
The port number of the source instance. You can run the
netstat -a | grep PGSQL
command to view the port number.Username
The username of the account that is used to create a DR relationship. In this example, replicatoraccount is used.
Password
The password of the account that is used to create a DR relationship.
Click Create Feasibility Assessment Task.
NoteDuring the feasibility assessment, the status of the destination RDS instance changes to Maintaining Instance.
In the DR Construction section of the page, you can view the status of the feasibility assessment task.
If the status of feasibility assessment task is Successful, you can perform the operations in Step 2: Create a DR construction task.
If the status of the feasibility assessment task is Failed, you can click View Report in the Actions column to view and handle the reported errors. For more information about the common errors, see Analyze a DR feasibility assessment report.
Step 2: Create a DR deployment task
You can perform the following operations only when the status of the feasibility assessment task is Successful.
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. On the page that appears, click 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 to create a DR deployment task.
You can view information about the DR deployment task in the task list on the DR Construction tab.
Click the Construction Phase column to view the phases that are required to complete the DR deployment task.
If Incremental Data Synchronization is displayed in the Construction Phase column, the DR deployment task is complete.
Click View Logs in the Actions column to view the log details of the DR deployment task.
Manage a DR instance
Rebuild a DR relationship
If an exception occurs during the synchronization between the source instance and the DR instance, such as a synchronization delay or interruption, you can rebuild the DR relationship between the instances to ensure that the synchronization process is run as expected.
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. On the page that appears, click the DR Construction tab.
Click Reconstruct DR Relationship.
Promote the DR instance
When the source instance fails, you can promote the DR instance as the new primary instance with a few clicks. This ensures that read and write requests can be processed as expected and helps implement high availability.
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction. On the page that appears, click the DR Construction tab.
Click Promote DR Instance.