Modifying Read Weight

Function

This API is used to modify the read weight of a specified DB instance.

Constraints

  • Only PostgreSQL 11 and PostgreSQL 12 are supported.
  • The database proxy of DB instances has been enabled.

URI

  • URI format

    PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/proxy/weight

  • Example

    https://rds.cn-north-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/proxy/weight

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Specifies the 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

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    master_weight

    Yes

    Integer

    Specifies the weight distributed to the primary DB instance. It can be a value from 0 to 1000.

    readonly_instances

    Yes

    Array of objects

    Specifies the read replica information.

    For details, see Table 3.

    Table 3 readonly_instances field data structure description

    Name

    Mandatory

    Type

    Description

    id

    Yes

    String

    Specifies the read replica ID.

    weight

    Yes

    Integer

    Specifies the weight distributed to a read replica. It can be a value from 0 to 1000.

  • Request example
    {
        "master_weight":0,
        "readonly_instances":[
            {
                "id":"83251d1398594b9fbfc8f1ab8b8228b2in03",
                "weight":100
            }
        ]
    }

Response

  • Normal response
    Table 4 Parameter description

    Name

    Type

    Description

    result

    String

    Indicates the modified result of the read weight.

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.