All Products
Search
Document Center

ApsaraDB RDS:Query and change the data replication mode

Last Updated:Oct 27, 2023

This topic describes how to query and change the data replication mode of an ApsaraDB RDS for PostgreSQL instance to improve the performance or availability of the RDS instance.

Prerequisites

  • The RDS instance runs RDS High-availability Edition with cloud disks.

  • If you want to set the Data Replication Mode parameter to Semi-synchronous, make sure that the minor engine version of your RDS instance is 20220228 or later. For more information, see Update the minor engine version.

Background information

ApsaraDB RDS for PostgreSQL allows you to change the data replication mode of an RDS instance that runs RDS High-availability Edition and uses cloud disks. This way, different levels of instance protection can be implemented based on your requirements for database availability and performance.

The following table describes the mappings between the data replication modes and protection levels.

Data replication mode

Protection level

Description

Asynchronous

Optimal performance

This is the default protection level. This protection level delivers the highest response speed but medium data persistence.

Synchronous

Optimal protection

This protection level delivers high data persistence but medium response speed.

Semi-synchronous

High availability

This protection level balances the response speed and data persistence.

Query the data replication mode

  1. 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.
  2. In the left-side navigation pane of the page that appears, click Service Availability.

  3. In the Availability Information section of the page that appears, check the value of the Data Replication Mode parameter.

    image.png

Change the data replication mode

Change the data replication mode in the ApsaraDB RDS console

  1. 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.
  2. In the left-side navigation pane of the page that appears, click Service Availability.

  3. On the page that appears, click Change Data Replication Mode.

    image.png
  4. Configure the Data Replication Mode parameter.

    数据复制方式
    Important

    If you want to set the Data Replication Mode parameter to Semi-synchronous, make sure that the minor engine version of your RDS instance is 20220228 or later. For more information, see Update the minor engine version.

  5. Click OK.

Change the data replication mode by modifying parameters

You can modify the following parameters to change the data replication mode: synchronous_commit, rds_sync_replication_timeout, and synchronous_standby_names.

  1. 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.
  2. In the left-side navigation pane of the page that appears, click Parameters.

  3. On the Editable Parameters tab, find the synchronous_commit, rds_sync_replication_timeout, and synchronous_standby_names parameters.

  4. In the Running Parameter Value column for each parameter, click the 笔 icon next to the original value. In the dialog box that appears, enter the new value and click OK.

    The following table describes the parameters that you must configure for each data replication mode.

    Data replication mode

    Parameter configuration

    Asynchronous

    synchronous_commit = off

    Note

    If you set the synchronous_commit parameter to off, the rds_sync_replication_timeout parameter is invalid.

    Synchronous

    • synchronous_commit = remote_write

    • rds_sync_replication_timeout = 0

    • synchronous_standby_names = 'standby1'

      Important

      The default value of the synchronous_standby_names parameter is standby1. If you have a self-managed secondary RDS instance, we recommend that you do not name the self-managed secondary RDS instance as standby1. If you name the self-managed secondary RDS instance as standby1, your RDS instance may replicate data to the self-managed secondary RDS instance in synchronous or semi-synchronous mode. As a result, data loss may occur in the event of a primary/secondary switchover.

    Semi-synchronous

    Note

    If you want to set the Data Replication Mode parameter to Semi-synchronous, make sure that the minor engine version of your RDS instance is 20220228 or later. For more information, see Update the minor engine version.

    • synchronous_commit = remote_write

    • rds_sync_replication_timeout > 0

      Note

      The rds_sync_replication_timeout parameter specifies the data synchronization timeout period in milliseconds. The value of this parameter ranges from 0 to 300000. We recommend that you set this parameter to 500. Unit: milliseconds. If a synchronization operation times out, the protection level is decreased to the optimal performance protection level that makes your RDS instance run in asynchronous mode. After data is synchronized, the protection level is increased to the high-availability protection level that makes your RDS instance run in semi-synchronous mode.

    • synchronous_standby_names = 'standby1'

      Important

      The default value of the synchronous_standby_names parameter is standby1. If you have a self-managed secondary RDS instance, we recommend that you do not name the self-managed secondary RDS instance as standby1. If you name the self-managed secondary RDS instance as standby1, your RDS instance may replicate data to the self-managed secondary RDS instance in synchronous or semi-synchronous mode. As a result, data loss may occur in the event of a primary/secondary switchover.

  5. Click Apply Changes.

    提交参数