PolarProxy provides read/write splitting, transaction splitting, and consistency level features. This topic describes how to configure these PolarProxy features when you create or modify a custom cluster endpoint.
Create a custom cluster endpoint
Log on to the PolarDB console.
In the upper-left corner, select the region in which the cluster is deployed.
Find the cluster and click its ID.
In the Database Connections section of the Basic Information page of the cluster, click Create Custom Cluster Endpoint.
In the Create Custom Cluster Endpoint dialog box, configure the parameters. The following table describes the parameters.
Table 1. Parameters
Parameter
Description
Network Information
By default, PolarDB provides a private endpoint for each cluster endpoint. You can change the private endpoint or apply for a public endpoint. For more information, see Manage an endpoint or Apply for an endpoint.
Cluster Settings
Read/Write
The read/write mode of the custom cluster endpoint. Valid values: Read-only and Read/Write (Automatic Read/Write Splitting).
NoteYou can change the read/write mode of a custom cluster endpoint after you create the cluster endpoint. After you change the read/write mode of a custom cluster endpoint, the new mode takes effect only for new connections. The original mode continues to take effect for existing connections.
Endpoint Name
The name of the custom cluster endpoint.
Node Settings
Available Nodes and Selected Nodes
Select the nodes that you want to associate with the cluster endpoint from the Available Nodes list on the left. Then, click the icon to add the nodes to the Selected Nodes list on the right.
NoteThe Available Nodes list contains the primary node and all read-only nodes.
The types of nodes that you select do not affect the read/write mode of the cluster endpoint. If you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting), write requests are sent only to the primary node regardless of whether the primary node is selected.
PolarDB allows you to create a cluster endpoint that is associated with only the primary node. However, if you set the Read/Write parameter to Read-only, you cannot create a cluster endpoint that is associated only with the primary node
Automatically Associate New Nodes
Specifies whether to automatically associate a new node with the cluster endpoint.
Load Balancing Settings
Load Balancing Policy
If you set the Read/Write parameter to Read-only, valid values are Connections-based Load Balancing and Active Request-based Load Balancing.
If you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting), the parameter value is Active Request-based Load Balancing by default and cannot be changed.
Primary Node Accepts Read Requests
If you set the Primary Node Accepts Read Requests parameter to No, SQL query requests are sent only to read-only nodes. This reduces the loads on the primary node and ensures the service stability of the primary node. For more information about protection for the primary node, see Read/write splitting.
NoteThis parameter is available only if you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting).
Transaction Splitting
Specifies whether to enable the transaction splitting feature. For more information, see Transaction splitting.
NoteThis parameter is available only if you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting).
Consistency Settings
Consistency Level
If you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting), the following consistency levels are available: Eventual Consistency (Weak) and Session Consistency (Medium). For more information, see Consistency levels.
If you set the Read/Write parameter to Read-only, the consistency level is Eventual Consistency (Weak) by default and cannot be changed.
NoteChanges to the consistency level immediately take effect on all connections.
Connection Pool Settings
Connection Pool
Selects Off (default) to disable the connection pool feature or Transaction-level to enable the transaction-level connection pool feature based on your business requirements. Transaction-level connection pools can help reduce high database load caused by a large number of connections. For more information, 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 in which the cluster is deployed.
Find the cluster and click its ID.
In the Database Connections section of the Basic Information page of the cluster, find the cluster endpoint that you want to modify and click Configure to the right of the endpoint name.
In the Modify Endpoint Settings dialog box, configure the parameters. For more information, see Custom cluster endpoint parameter settings.
Click OK.
Release a custom cluster endpoint
You can release only custom cluster endpoints. You cannot release the default cluster endpoint.
After you release a custom cluster endpoint, you cannot restore it, and you must change the cluster endpoint of your application at the earliest opportunity.
Log on to the PolarDB console.
In the upper-left corner, select the region in which the cluster is deployed.
Find the cluster and click its ID.
In the Database Connections section of the Basic Information page of the cluster, find the cluster endpoint that you want to release and click to the right of the endpoint name.
In the dialog box that appears, click OK.
Related API operations
Operation | Description |
Creates a custom cluster endpoint for a PolarDB cluster. | |
Queries the cluster endpoints of a PolarDB cluster. | |
Release a custom cluster endpoint of a PolarDB cluster. |