PolarProxy is the built-in proxy layer for PolarDB clusters. It handles read/write splitting, transaction splitting, and read consistency — all configured through a custom cluster endpoint.
A custom cluster endpoint lets you control exactly how traffic is routed to your primary and read-only nodes, independently of the default cluster endpoint. Use it when the default endpoint's routing behavior doesn't fit your workload.
Prerequisites
Before you begin, ensure that you have:
A PolarDB for PostgreSQL cluster
Access to the PolarDB console
Create a custom cluster endpoint
Log on to the PolarDB console.
In the upper-left corner, select the region where your cluster is deployed.
Find the cluster and click its ID.
On the Basic Information page, go to the Database Connections section and click Create Custom Cluster Endpoint.
In the Create Custom Cluster Endpoint dialog box, configure the following parameters.
Network information
Parameter Description Network Information PolarDB provides a private endpoint for each cluster endpoint by default. To change the private endpoint or add a public endpoint, see Modify an endpoint and Apply for an endpoint. Cluster settings
Parameter Description Read/Write The read/write mode of the custom cluster endpoint. Valid values: Read-only and Read/Write (Automatic Read/Write Splitting). NoteAfter you change the read/write mode, the new mode applies only to new connections. Existing connections continue using the previous mode.
Endpoint Name A name for the custom cluster endpoint. Node settings
Parameter Description Available Nodes and Selected Nodes Select nodes to associate with this endpoint. Move nodes from the Available Nodes list to the Selected Nodes list by clicking the
icon. NoteThe Available Nodes list includes the primary node and all read-only nodes. Node selection does not affect the read/write mode — in Read/Write (Automatic Read/Write Splitting) mode, write requests always go to the primary node regardless of whether the primary node is selected. If you set Read/Write to Read-only, you cannot create an endpoint that contains only the primary node.
Automatically Associate New Nodes Whether to automatically associate newly added nodes with this endpoint. Load balancing settings
Parameter Description Load Balancing Policy Determines how read traffic is distributed across nodes. If Read/Write is Read-only, choose Connections-based Load Balancing (distributes by connection count) or Active Request-based Load Balancing (distributes by in-flight request count). If Read/Write is Read/Write (Automatic Read/Write Splitting), the policy is fixed to Active Request-based Load Balancing. Primary Node Accepts Read Requests Available only in Read/Write (Automatic Read/Write Splitting) mode. Set to No to route all read (SELECT) traffic to read-only nodes only, reducing load on the primary node. For details, see Read/write splitting. Transaction splitting
Parameter Description Transaction Splitting Available only in Read/Write (Automatic Read/Write Splitting) mode. Specifies whether to enable the transaction splitting feature. For details, see Transaction splitting. Consistency settings
Parameter Description Consistency Level Controls whether reads reflect the latest writes. In Read/Write (Automatic Read/Write Splitting) mode, choose Eventual Consistency (Weak) or Session Consistency (Medium). In Read-only mode, the consistency level is fixed to Eventual Consistency (Weak). Changes to the consistency level take effect immediately on all connections. For details, see Consistency levels. Connection pool settings
Parameter Description Connection Pool Off (default) disables connection pooling. Transaction-level enables the transaction-level connection pool feature, which reduces high database load caused by a large number of connections. For details, see Transaction-level connection pools. Click OK.
Modify a custom cluster endpoint
Log on to the PolarDB console.
In the upper-left corner, select the region where your cluster is deployed.
Find the cluster and click its ID.
On the Basic Information page, go to the Database Connections section, find the endpoint you want to modify, and click Configure to the right of the endpoint name.
In the Modify Endpoint Settings dialog box, update the parameters. For parameter descriptions, see Create a custom cluster endpoint.
Click OK.
Release a custom cluster endpoint
You can only release custom cluster endpoints. The default cluster endpoint cannot be released. After release, the endpoint cannot be restored — update your application's connection string before releasing.
Log on to the PolarDB console.
In the upper-left corner, select the region where your cluster is deployed.
Find the cluster and click its ID.
On the Basic Information page, go to the Database Connections section, find the endpoint you want to release, and click Release to the right of the endpoint name.
In the confirmation dialog box, click OK.
API reference
| Operation | Description |
|---|---|
| CreateDBClusterEndpoint | Creates a custom cluster endpoint for a PolarDB cluster. |
| DescribeDBClusterEndpoints | Queries the cluster endpoints of a PolarDB cluster. |
| DeleteDBClusterEndpoint | Releases a custom cluster endpoint of a PolarDB cluster. |