Updated on 2022-12-12 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

  • This API can only be used to add read replicas to replica set instances.
  • A maximum of five read replicas can be added to a replica set instance.
  • 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

    The 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.

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 scale up the storage of 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.

Request Example

Example of adding read replicas to replica set instances

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.