Modifying Read Weight
Function
This API is used to modify the read weight of a specified DB instance.
- Before calling an API, you need to understand the API in Authentication.
- Before calling this API, obtain the required region and endpoint.
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.
- 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.
- Example normal response
{ "result":"success" } - Abnormal response
For details, see Abnormal Request Results.
Status Code
For details, see Status Codes.
Error Code
For details, see Error Codes.
Last Article: Querying Information About Database Proxy
Next Article: Changing the Delay Threshold of Read/Write Splitting
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.