Updated on 2024-04-02 GMT+08:00

Adding a Read Replica to an Instance

API Description

This API is used to add read replicas to DDS replica set instances.

Restrictions

  • Currently, this API only supports replica set instances and cluster instances 3.4.
  • A maximum of five read replicas can be added to a replica set instance.
  • In a cluster instance, up to five read replicas can be added to a shard.
  • In a cluster instance, read replicas can be added to only one shard at a time.
  • The synchronization delay cannot be set for cluster instances. The default value is 0.
  • This API supports both yearly/monthly and pay-per-use DB instances.

URI

  • URI format

    POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/readonly-node

  • URI example
    https://dds.cn-north-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/9136fd2a9fcd405ea4674276ce36dae8in02/readonly-node
    Table 1 Request parameters

    Name

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

    instance_id

    Yes

    String

    Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

    Table 2 Request header parameters

    Name

    Mandatory

    Type

    Description

    X-Auth-Token

    Yes

    String

    User token obtained from IAM. For details, see Authentication.

Request Parameters

  • Parameter description
    Table 3 Request body parameters

    Name

    Mandatory

    Type

    Description

    spec_code

    Yes

    String

    The resource specification code. For details about how to obtain the value, see the parameter value in Querying Database Specifications. Example: dds.mongodb.c6.large.4.rr

    num

    Yes

    Integer

    Number of read replicas to be added. The value ranges from 1 to 5.

    delay

    No

    Integer

    Synchronization delay. The value ranges from 0 to 1200, in milliseconds. The default value is 0.

    is_auto_pay

    No

    Boolean

    Whether the order is automatically paid from your account when you add read replicas to a yearly/monthly DB instance. This parameter does not affect the payment mode of automatic renewal.

    • true: indicates that the order is automatically paid from the account.
    • false: indicates that the order is manually paid from the account. The default value is false.

Example Request

Adding one read replica who spec_code is set to dds.mongodb.c6.large.4.rr, and delay is set to 0

POST https://dds.cn-north-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/9136fd2a9fcd405ea4674276ce36dae8in02/readonly-node 
 
{  
    "spec_code": "dds.mongodb.c6.large.4.rr",
    "num" : 1,  
    "delay" : 0 
}

Response Parameters

Table 4 Response body parameters

Name

Type

Description

job_id

String

Task ID.

order_id

String

Order ID. This parameter is available only when nodes of a yearly/monthly DB instance are added.

Response Example

{ 
  "job_id" : "4008c8914b624785a02ab7966d4d" 
}

Status Code

For details, see Status Code.

Error Code

For details, see Error Code.