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

Modifying Read Weight

Function

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

This API will be unavailable on April 30, 2024.

  • Before calling an API, you need to understand the API in Authentication.

Constraints

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

URI

  • URI format

    PUT /v3/{project_id}/instances/{instance_id}/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

String

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.

Example Request

https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/f569f1358436479dbcba8603c32cc4aein03/proxy/weight

{
    "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

Error Code

For details, see Error Codes.