Help Center/ Relational Database Service/ API Reference/ API v3 (Recommended)/ DR Instances/ Promoting a DR Instance to Be the Primary DB Instance
Updated on 2024-08-28 GMT+08:00

Promoting a DR Instance to Be the Primary DB Instance

Function

This API is used to promote a DR instance to be the primary DB instance when a cross-cloud or cross-region DR relationship between DB instances has become abnormal.

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 while security group rules are not configured.

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

Constraints

  • The primary DB instance and DR instance are available and are deployed in different clouds or regions. The DR instance is deployed in standalone mode.
  • The DR relationship between the primary DB instance and DR instance has been established.
  • RDS for PostgreSQL 12 and later versions support DR instance promotion to the primary instance.

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.

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

    instance_id

    Yes

    Specifies the DB instance ID.

Request

Table 2 Parameter description

Name

Mandatory

Type

Description

drreplica_to_master

Yes

Object

Specifies whether the DR instance is promoted to be the primary instance. No other parameters are required.

Example Request

Promote a DR instance to the primary DB instance.
POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/24c6678f474241fe89ee9c42f768022ein03/action 

{
	"drreplica_to_master": {}
}

Response

  • Normal response
    Table 3 Parameter description

    Name

    Type

    Description

    job_id

    String

    Indicates the workflow ID.

  • Example normal response
    {
    	"job_id": "04efe8e2-9255-44ae-a98b-d87cae411890"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.