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

RDS for PostgreSQL

Copy page
Download PDF
Managing connections
ModifyDBEndpointReadWriteFlag
Copy page
Download PDF
ModifyDBEndpointReadWriteFlag
Call the ModifyDBEndpointReadWriteFlag API to enable or disable read-write separation.​
Request type​
Asynchronous request.​
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.​
ReadWriteSpliting​
Boolean​
Yes​
true​
Enable read-write separation? Values:​
  • true: enable read-write separation.​
  • -false: do not enable read/write separation.​
ReadOnlyNodeMaxDelayTime​
Integer​
No​
30​
Maximum latency threshold for read-only nodes. When the latency of a read-only node exceeds this value, read traffic will not be routed to that node. Unit is seconds, ranging from 0 to 3,600. Default value: 30.​
tip​
Read/Write type endpoints support setting this parameter after enabling read-write separation.​
ReadOnlyNodeDistributionType​
String​
No​
Default​
Read weight allocation mode. This parameter can be passed when enabling read-write separation, that is, when ReadWriteSpliting is set to true. Values:​
  • Default: automatic allocation that determines the node weight based on the memory size of each read-only node under the connection endpoint. Default value.​
  • custom: customized weight allocation. Set the read weight of each node in the ReadOnlyNodeWeight field.​
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.​
ReadWriteProxyConnection​
Integer​
No​
200​
Set the number of proxy connections for the endpoint after enabling read-write separation.​
  • The minimum value of proxy connections is 20.​
  • The maximum number of proxy connections depends on the specification of the instance primary node. Different specifications support different maximum numbers of proxy connections. For details, refer to Product specification.​
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=ModifyDBEndpointReadWriteFlag&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-c23003b1****",​
"EndpointId": "postgres-c23003b1****-cluster",​
"ReadWriteSpliting": true,​
"ReadOnlyNodeMaxDelayTime": 31,​
"ReadOnlyNodeDistributionType": "Custom",​
"ReadOnlyNodeWeight": [​
{​
"NodeType": "Primary",​
"Weight": 300​
},​
{​
"NodeId": "postgres-c23003b1****-rof359",​
"NodeType": "ReadOnly",​
"Weight": 600​
}​
]​
}​
​
Sample response​
​
{​
"ResponseMetadata": {​
"RequestId": "2023101118285676A8F34389CC270EE9CA",​
"Action": "ModifyDBEndpointReadWriteFlag",​
"Version": "2022-01-01",​
"Service": "rds_postgresql",​
"Region": "cn-beijing"​
},​
"Result": null​
}​
​
Last updated: 2026.03.31 10:45:18