Updated on 2025-08-20 GMT+08:00

Configuring the DR Capability for a Primary DB Instance

Function

This API is used to configure DR for a primary DB instance when establishing a cross-cloud or cross-region DR relationship.

Constraints

  • 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.
  • The primary DB instance and DR instance are available and are deployed in different clouds or regions. The primary DB instance is deployed in primary/standby mode and the DR instance is deployed in standalone mode.
  • The vCPUs, memory, and storage space of the DR instance must be greater than or equal to those of the primary instance.
  • The underlying architecture and major version of the DR instance must be the same as those of the primary DB instance.
  • If the DR instance's minor version differs from the primary DB instance, it will automatically update to be the same as that of the primary DB instance after the DR relationship is established.
  • Cross-cloud or cross-region DR relationships cannot be established across major versions.
  • After the API for configuring DR for the primary instance is called, you cannot change the instance class or perform a primary/standby switchover until the DR relationship is set up.
  • After changing the database port or floating IP address of the primary instance, you need to re-establish the DR relationship.
  • RDS for PostgreSQL 12 and later versions support cross-cloud or cross-region DR.

URI

  • URI format

    POST /v3/{project_id}/instances/{instance_id}/action

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    instance_id

    Yes

    Specifies the DB instance ID.

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

build_master_dr_relation

Yes

Object

Specifies the DR instance information required for configuring the DR relationship for the primary DB instance.

For details, see Table 3.

Table 3 build_master_dr_relation field description

Parameter

Mandatory

Type

Description

target_instance_id

Yes

String

Specifies the ID of the DR instance.

target_project_id

Yes

String

Specifies the project ID of the tenant to which the DR instance belongs.

target_region

Yes

String

Specifies the ID of the region where the DR instance resides.

target_ip

Yes

String

Specifies the data virtual IP address (VIP) of the DR instance.

target_subnet

Yes

String

Specifies the subnet IP address of the DR instance.

Example Request

Configure a DR relationship for a primary DB instance, with the DR instance deployed in region aaa.
POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/24c6678f474241fe89ee9c42f768022ein03/action 
{
    "build_master_dr_relation": {
           "target_instance_id":"c39bd176fb0540929f6add80b91b212cin03",
           "target_project_id":"054b61972980d4552f0bc00ac8d3f5cd",
           "target_region":"aaa",
           "target_ip":"192.168.3.238",
           "target_subnet":"192.168.3.1/24"
    }
}

Response

  • Normal response
    Table 4 Parameters

    Parameter

    Type

    Description

    job_id

    String

    Workflow ID.

  • Example normal response
    {
    	"job_id": "184f29cd-be1a-43f1-5b6bc5500e73"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.