Updated on 2024-07-22 GMT+08:00

Configuring Replication Delay for a Read Replica

Scenarios

You can configure a replication delay for a read replica. The read replica replays the WAL logs received from the primary instance after the specified delay.

If any data is deleted from your DB instance by mistake, it will be deleted from the read replica after the specified delay. During this time period, you can stop WAL log replay on the read replica, dump the data from the read replica, and insert it into the primary instance to quickly restore the data.

Constraints

  • To use this function, contact customer service to apply for required permissions.
  • This function is only available to read replicas of RDS for PostgreSQL 12 and later versions.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. In the instance list, click in front of the target DB instance and then click the name of the target read replica.
  5. Go to the Read Replica Delay page or refresh the page. The read replica delay details at the current time are displayed.

    Figure 1 Read Replica Delay Details
    Table 1 Read replica delay details

    Parameter

    Description

    WAL Replay

    The WAL replay status of the read replica. You can pause or resume WAL replay by toggling the switch.

    • Toggling on the switch: The WAL replay starts.
    • Toggling off the switch: The WAL replay pauses.

    Actual Delay

    The actual delay for WAL log replay on the read replica during page loading or refreshing, in ms.

    The value of this parameter is slightly different from that of Custom Delay. For example, if there are no data writes to the primary instance and no WAL synchronization is performed, the actual delay is 0 ms.

    Custom Delay

    User-defined delay, in ms. Click to edit it.

    The delay cannot be too long. Otherwise, if the primary instance is heavily loaded, a large number of WAL logs are stacked on the read replica, causing full storage or even read replica disconnection.

    Latest Replayed WAL Log Position

    The latest WAL log position replayed by the read replica.

    Latest Received WAL Log Position

    The latest WAL log position received by the read replica.