This topic describes how to create and modify a custom cluster endpoint. You can enable or disable features such as read/write splitting, transaction splitting, and consistency level when you create or modify a custom cluster endpoint.
Create a custom cluster endpoint
When you create a custom cluster endpoint, you can enable or disable read/write splitting, transaction splitting, and consistency level.
Procedure
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
- Find the cluster and click the cluster ID.
In the Endpoints section, click Create Custom Cluster Endpoint.
In the Create Custom Cluster Endpoint dialog box, set the following parameters.
Table 1. Parameters for creating a custom cluster endpoint Parameter
Description
Network Information
By default, PolarDB for MySQL provides a public endpoint for each cluster. For more information about how to modify the public endpoint or apply for a VPC endpoint,see Modify an endpoint and Apply for an endpoint.
Cluster Settings
Read/Write
Specifies the read/write mode for the custom cluster endpoint. You can select Read-only or Read/Write (Automatic Read/Write Splitting).
NoteYou can change the read/write mode of a custom cluster endpoint after the custom cluster endpoint is added. After you change the read/write mode, the new mode takes effect only on newly created connections. The existing connections still work in the original mode.
Endpoint Name
The name of the cluster endpoint.
Node Settings
Available Nodes and Selected Nodes
Select the nodes that you want to add to process read requests from the Available Nodes section on the left and click the
icon. Then, move the nodes to the Selected Nodes section on the right.
NoteThe Available Nodes list shows the primary node and all read-only nodes.
The types of nodes that you select do not affect the read/write mode. If you set the read/write mode 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 for MySQL allows you to create a cluster endpoint that is associated with only the primary node. However, when the read/write mode is set to Read-only, you are not allowed to create a cluster endpoint that is associated only with the primary node.
Automatically Associate New Nodes
Specifies whether to automatically associate a newly added node with the cluster endpoint.
SLB Settings
Load Balancing Policy
Specifies the load balancing policy that is used to distribute read requests to multiple read-only nodes when read/write splitting is enabled. The default value is Load-based Automatic Scheduling and cannot be changed.
Primary Node Accepts Read Requests
After you set Primary Node Accepts Read Requests 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, see Read/write splitting.
NoteThis parameter is available only if the read/write mode is set 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 mode to Read/Write (Automatic Read/Write Splitting).
Consistency Settings
Consistency Level
If you set Read/write Mode 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 mode to Read-only, the default consistency level is Eventual Consistency (Weak) and cannot be changed.
NoteChanges to the consistency level immediately take effect on all connections.
Click OK.
Modify a custom cluster endpoint
When you modify a custom cluster endpoint, you can enable or disable read/write splitting, transaction splitting, and consistency level.
Procedure
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
- Find the cluster and click the cluster ID.
In the Endpoints section, find the custom cluster endpoint that you want to modify, and choose Modify next to the cluster endpoint.
In the Modify Endpoint Settings dialog box, you can set relevant parameters. For more information about the parameters, see Parameters for creating a custom cluster endpoint.
Click OK.
Delete a custom cluster endpoint
You can delete only custom cluster endpoints. The default cluster endpoint cannot be deleted.
The deleted custom cluster endpoint cannot be recovered. You must change the endpoint for connecting the client to the cluster at the earliest opportunity.
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
- Find the cluster and click the cluster ID.
In the Endpoints section, find the cluster endpoint that you want to modify, and choose on the right side of the cluster endpoint.
In the message that appears, click OK.
Related API operations
Operation | Description |
Creates a custom cluster endpoint for a specified PolarDB cluster. | |
Queries the cluster endpoints of a PolarDB cluster. | |
Deletes a custom cluster endpoint of a PolarDB cluster. |