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

Adding a Read Replica to an Instance

API Description

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

Restrictions

  • This API can only be used to add read replicas to replica set instances and cluster instances.
  • 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

    Definition

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

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    instance_id

    Yes

    String

    Definition

    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.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    Table 2 Request header parameters

    Name

    Mandatory

    Type

    Description

    X-Auth-Token

    Yes

    String

    Definition

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

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request Parameters

  • Parameter description
    Table 3 Request body parameters

    Name

    Mandatory

    Type

    Description

    spec_code

    Yes

    String

    Definition

    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

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    num

    Yes

    Integer

    Definition

    Number of read replicas to be added.

    Constraints

    N/A

    Range

    1–5

    Default Value

    N/A

    delay

    No

    Integer

    Definition

    Synchronization delay.

    Constraints

    This parameter cannot be set for cluster instances.

    Range

    0 to 1,200 ms

    Default Value

    0

    is_auto_pay

    No

    Boolean

    Definition

    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.

    Constraints

    N/A

    Range

    • true: The order is automatically paid from the account.
    • false: The order is manually paid from the account.

    Default Value

    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

Definition

Task ID. This parameter is returned only for pay-per-use DB instances.

Range

N/A

order_id

String

Definition

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

Range

N/A

Example Response

{ 
  "job_id" : "4008c8914b624785a02ab7966d4d" 
}

Status Code

For details, see Status Code.

Error Code

For details, see Error Code.