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
  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster that you want to manage is deployed.
  3. Find the cluster you want to manage and click the cluster ID.
  4. In the Endpoints section, click Create Custom Cluster Endpoint.
  5. 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 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 Mode Specifies the read/write mode for the custom cluster endpoint. You can select Read Only or Read and Write (Automatic Read-write Splitting).
    Note You 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 Unselected Nodes and Selected Nodes Select the nodes that you want to add to process read requests from the Unselected Nodes section on the left and click the 1 icon. Then, move the nodes to the Selected Nodes section on the right.
    Note
    • The Unselected 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 and 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, 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.
    Note This parameter is available only if the read/write mode is set to Read and Write (Automatic Read-write Splitting).
    Transaction Splitting Specifies whether to enable the transaction splitting feature. For more information, see Transaction splitting.
    Note This parameter is available only if you set the read/write mode to Read and Write (Automatic Read-write Splitting).
    Consistency Settings Consistency Level
    • If you set Read/write Mode to Read and 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.
    Note Changes to the consistency level immediately take effect on all connections.
  6. 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
  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster that you want to manage is deployed.
  3. Find the cluster you want to manage and click the cluster ID.
  4. In the Endpoints section, find the custom cluster endpoint that you want to modify, and choose Modify next to the cluster endpoint.
  5. In the Configure Nodes dialog box, you can set relevant parameters. For more information about the parameters, see Table 1.
  6. Click OK.

Delete a custom cluster endpoint

Note
  • 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.
  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster that you want to manage is deployed.
  3. Find the cluster you want to manage and click the cluster ID.
  4. In the Endpoints section, find the cluster endpoint that you want to modify, and choose Settings > Delete on the right side of the cluster endpoint.
  5. In the message that appears, click OK.

Related API operations

Operation Description
CreateDBClusterEndpoint Creates a custom cluster endpoint for a specified PolarDB cluster.
DescribeDBClusterEndpoints Queries the cluster endpoints of a PolarDB cluster.
DeleteDBClusterEndpoint Deletes a custom cluster endpoint of a PolarDB cluster.