You need to enable JavaScript to run this app.
RDS for PostgreSQL

RDS for PostgreSQL

Copy page
Download PDF
Managing connections
ModifyDBEndpointReadWeight
Copy page
Download PDF
ModifyDBEndpointReadWeight
Call the ModifyDBEndpointReadWeight API to modify the read weight distribution mode and custom weight ratio of an endpoint.​
Request type​
Synchronous request.​
Precautions​
  • Read/Write separation function of the connected endpoint is enabled.​
  • This API only applies to the default endpoint, as read/write separation is supported only on the default endpoint.​
Debug​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
​
Parameter​
Type​
Required?​
Example​
Description​
InstanceId​
String​
Yes​
postgres-0af11cd4****​
Instance ID.​
EndpointId​
String​
Yes​
postgres-0af11cd4****-cluster​
Instance ID.​
ReadOnlyNodeDistributionType​
String​
No​
Default​
Read-only weight allocation mode. Values:​
  • Default: standard weight allocation (default value).​
  • custom: customized weight allocation.​
ReadOnlyNodeWeight​
Array of NodeWeightObject​
No​
[​
{"NodeType" : "Primary",​
"Weight" : 100​
},​
{​
"NodeId" : "postgres-c23003b1****-rof359",​
"Weight" : 100​
}​
]​
Custom read weight allocation, which means passing the read request weights of the primary and read-only nodes. Increment by 100, with a maximum value of 40000.​
tip​
  • When ReadOnlyNodeDistributionType is set to Custom, this parameter must be provided.​
  • The primary node requires NodeType to be Primary, and the read-only node requires NodeID.​
  • The weights cannot all be set to 0.​
WriteNodeHaltWriting​
Boolean​
No​
false​
Specifies whether to prohibit the endpoint from sending write requests to the write node (currently, only the primary node is the write node). Values:​
  • true: yes.​
  • false: no.​
tip​
To ensure that write traffic can be properly handled, this configuration can only be enabled when the instance has another read/write endpoint available.​
​
NodeWeightObject​
​
Parameter​
Type​
Required?​
Example​
Description​
NodeId​
String​
No​
postgres-c23003b1****-ojmo​
Read-only node requires passing in NodeId.​
tip​
No NodeId is needed for the primary node.​
NodeType​
String​
Yes​
Primary​
Node type. Values:​
  • Primary: primary node.​
  • ReadOnly: Read-only node.​
Weight​
Integer​
Yes​
100​
The read weight of the node, increasing by 100, with a maximum value of 40,000.​
tip​
Weights cannot all be set to 0.​
​
Response parameters​
null​
Sample​
Sample request​
​
POST /?Action=ModifyDBEndpointReadWeight&Version=2022-01-01 HTTP/1.1​
Content-Type: application/json​
Host: rds-postgresql.cn-beijing.volcengineapi.com​
X-Date: 20231002T101010Z​
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_postgresql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****​
{​
"InstanceId": "postgres-0af11cd4****",​
"EndpointId": "postgres-0af11cd4****-cluster",​
"ReadOnlyNodeDistributionType": "Custom",​
"ReadOnlyNodeWeight": [​
{​
"NodeType": "Primary",​
"Weight": 600​
},​
{​
"NodeId": "postgres-c23003b1****-rof359",​
"NodeType": "ReadOnly",​
"Weight": 300​
}​
]​
}​
​
Sample response​
​
{​
"ResponseMetadata": {​
"RequestId": "2023101118285676A8F34389CC270EE9CA",​
"Action": "ModifyDBEndpointReadWeight",​
"Version": "2022-01-01",​
"Service": "rds_postgresql",​
"Region": "cn-beijing"​
},​
"Result": null​
}​
​
Last updated: 2026.03.31 10:45:18