View and change the data replication mode of an ApsaraDB RDS for PostgreSQL instance to optimize database performance or availability.
Prerequisites
-
The instance uses High-availability Edition with cloud disks.
-
To change the Data Replication Mode to Semi-synchronous, the minor engine version must be 20220228 or later. Upgrade the minor engine version.
Data replication modes
ApsaraDB RDS for PostgreSQL High-availability Edition (cloud disk) instances support three data replication modes with different trade-offs between performance and data durability.
The following table describes each mode.
|
Data replication mode |
Protection level |
Description |
|
Asynchronous mode (Default) |
Highest performance |
Fastest response time. Best when data durability is not a high priority. |
|
Synchronous mode |
Maximum protection |
Highest data durability at the cost of slower response times. Best for strict data consistency requirements. |
|
Semi-synchronous mode |
Highest availability |
Balances data durability and response time. |
View data replication mode
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 ID of the instance.
-
In the left-side navigation pane, click Service Availability.
-
View the data replication mode in the Availability Information section.
For example, the value may show Asynchronous.
Change data replication mode
Console
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 ID of the instance.
-
In the left-side navigation pane, click Service Availability.
-
Click Change Data Replication Mode.
This link is in the upper-right corner of the Instance Availability section.
-
Select Data Replication Mode.
In the confirmation dialog box, select Synchronous, Semi-synchronous, or Asynchronous, and then click OK.
ImportantTo change the Data Replication Mode to Semi-synchronous, the minor engine version must be 20220228 or later. Upgrade a minor engine version.
-
Click OK.
Parameters
Set the data replication mode by modifying the synchronous_commit, rds_sync_replication_timeout, and synchronous_standby_names parameters.
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 ID of the instance.
-
In the left navigation pane, click Parameters.
-
On the Editable Parameters tab, find the parameters synchronous_commit, rds_sync_replication_timeout, and synchronous_standby_names.
-
Click
to modify the parameter value and click OK.The following table lists the parameter settings for each mode.
Data replication mode
Parameter settings
Asynchronous mode
synchronous_commit = off
NoteIf synchronous_commit is set to off, rds_sync_replication_timeout has no effect.
Synchronous mode
-
synchronous_commit = remote_write
-
rds_sync_replication_timeout = 0
-
synchronous_standby_names = 'standby1'
ImportantIf you have a self-managed standby instance, do not name it standby1 because the default value of synchronous_standby_names is standby1. If a name conflict causes synchronous or semi-synchronous replication to select the wrong instance, RDS cannot guarantee zero data loss during primary/standby switchover.
Semi-synchronous mode
NoteTo modify the Data Replication Mode to Semi-synchronous, the minor engine version must be 20220228 or later. Upgrade minor engine version.
-
synchronous_commit = remote_write
-
rds_sync_replication_timeout > 0
NoteThe value of rds_sync_replication_timeout specifies the synchronization timeout in milliseconds. Range: 0–300,000. Recommended: 500. On timeout, the system degrades to asynchronous mode and returns to semi-synchronous mode after synchronization completes.
-
synchronous_standby_names = 'standby1'
ImportantIf you have a self-managed standby database, do not name it standby1, because the default value of synchronous_standby_names is standby1. A naming conflict may cause replication to select the wrong instance, preventing RDS from guaranteeing zero data loss during primary/standby switchover.
-
-
Click Apply Changes.