Help Center/ GeminiDB/ API Reference/ APIs v3/ Disaster Recovery/ Creating a DR Relationship with a Specified Instance
Updated on 2023-11-21 GMT+08:00

Creating a DR Relationship with a Specified Instance

Function

This API is used to create a DR relationship with a specified instance.

A DR relationship is created between two instances only after this API is successfully called for both of the instances, respectively.

Constraints

This API supports GeminiDB Redis instances.

A DR relationship cannot be created between two instances in a CIDR block starting with 192 or 172.

The port number of the DR instance must be 8635.

URI

POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/disaster-recovery/construction

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

id

No

String

DR relationship ID.

This parameter is not passed when a DR relationship is created for an instance whose DR role is primary. A DR relationship ID is generated after a success response is returned.

This parameter is mandatory when a DR relationship is created for an instance whose DR role is standby. The value of this parameter must be the same as the generated DR relationship ID.

alias

Yes

String

Alias of the created DR relationship.

password

Yes

String

Password for creating a DR relationship. Make sure to pass the same password when you invoke the API twice to create a DR relationship. This password is used for internal data communication within the DR cluster and cannot be used for client connection.

instance_role

Yes

String

Instance role for DR. The value can be master or slave, indicating that the instance role for DR is primary or standby.

disaster_recovery_instance

Yes

object

Information about the DR instance. For details, see Table 4.

Table 4 DisasterRecoveryInstance

Parameter

Mandatory

Type

Description

id

Yes

String

DR instance ID.

region_code

Yes

String

Code of the region where the DR instance is located.

subnet_cidrs

Yes

Array of strings

CIDR blocks of the subnet where the DR instance is located.

node_ips

Yes

Array of strings

IP addresses of all nodes of the DR instance.

Response Parameters

Status code: 202

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

ID of the job that creates the DR relationship

disaster_recovery_id

String

DR relationship ID

Example Requests

  • URI example
    POST https://gaussdb-nosql.eu-west-101.myhuaweicloud.eu/v3/054e292c9880d4992f02c0196d3ea468/instances/054e292c9880d4992f02c0196d3ein12/disaster-recovery/construction
  • Creating a DR relationship with a specified instance (Set alias to Video business DR, password to *****, and instance_role to master.)
    {
        "alias" : "Video business DR"
        "password" : "*****",
        "instance_role" : "master",
        "disaster_recovery_instance" : {
         
         
          "region_code" : "eu-west-101",
          "id" : "430e7468a309459eb83c5981001415dein12",
          "subnet_cidrs" : [ "10.0.1.0/24" ],
          "node_ips" : [ "10.0.1.2", "10.0.1.3", "10.0.1.4" ]
        }
    }

Example Responses

Status code: 202

Accepted

{
  "job_id" : "c010abd0-48cf-4fa8-8cbc-090f093eaa2f",
  "disaster_recovery_id" : "04efe8e2-9255-44ae-a98b-d87cae411890"
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.