Updated on 2024-08-28 GMT+08:00

Querying the DR Replication Status

Function

This API is used to query the replication status and delay between the primary DB instance and DR instance after a cross-cloud or cross-region DR relationship is established.

Before using this function, ensure that the network between the VPC CIDR blocks of the DB instances across clouds or regions is connected, and configure security group rules to allow access from database ports in the VPC CIDR blocks. The DR relationship cannot be established if only the network is connected but security group rules are not configured.

  • Before calling an API, you need to understand the API in Authentication.

Constraints

  • A DR relationship between the primary DB instance and DR instance has been established.
  • DR instances of RDS for PostgreSQL 12 and later versions support DR replication status query.

URI

  • URI format

    GET /v3/{project_id}/instances/{instance_id}/disaster-recovery

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    instance_id

    Yes

    DR instance ID.

Request

  • Parameter description

    None

  • Example

    GET https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/24c6678f474241fe89ee9c42f768022ein03/disaster-recovery

  • Request example

    None

Response

  • Normal response
    Table 2 Parameter description

    Name

    Type

    Description

    replica_state

    String

    Indicates the synchronization status. The value can be 0 or -1. The value 0 indicates that the synchronization status is normal, and the value -1 indicates that the synchronization status is abnormal.

    NOTE:

    If the primary DB instance does not exist, the synchronization status between the primary DB instance and DR instance is abnormal.

    wal_write_receive_delay_in_mb

    String

    Indicates the sending delay in MB, that is, the difference between the WAL Log Sequence Number (LSN) written by the primary DB instance and the WAL LSN received by the DR instance.

    wal_write_replay_delay_in_mb

    String

    Indicates the end-to-end delay in MB, that is, the difference between the WAL LSN written by the primary DB instance and the WAL LSN replayed by the DR instance.

    wal_receive_replay_delay_in_ms

    String

    Indicates the replay delay in millisecond on the DR instance.

  • Example normal response
    {
       "replica_state": "0",    
       "wal_write_receive_delay_in_mb": "10.0",
       "wal_write_replay_delay_in_mb": "10.0",    
       "wal_receive_replay_delay_in_ms": "0"
    }
  • Abnormal Response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.