This topic describes how to use a cluster endpoint to configure the PolarDB proxy for a PolarDB cluster.

Prerequisites

The edition of the ApsaraDB PolarDB MySQL-compatible edition cluster is Cluster Edition. Single Node and Archive Database are not supported. For more information about the editions, see Product editions.

Note

  • You can enable parallel queries and configure the degree of parallelism for an PolarDB cluster only if the cluster runs MySQL 8.0 and has the PolarDB proxy configured.

Procedure

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the Endpoints section of the Overview page, find the cluster endpoint that you want to manage and click Modify on the right side of the cluster endpoint.
  5. In the dialog box that appears, modify the configuration of the cluster endpoint based on your business requirements. The following table describes the parameters.
    Table 1. Configuration table
    Parameter Description
    Network Information PolarDB provides a default private endpoint for each cluster endpoint. For more information about how to modify the private endpoint or apply for a public endpoint,see Apply for a cluster endpoint or a primary endpoint.
    Cluster Settings Read/write Mode The read/write mode of the cluster endpoint. You can select Read Only or Read and Write (Automatic Read-write Splitting).
    Note After you create a custom cluster endpoint, you can change the read/write mode of the custom cluster endpoint. Changes to the read/write mode take effect only on new connections. The existing connections use the original read/write mode.
    Endpoint Name The name of the cluster endpoint.
    Node Settings Unselected Nodes and Selected Nodes Select the nodes that you want to associate with the cluster endpoint to process read requests from the Unselected Nodes section on the left. Then, click the 1 icon to move the nodes to the Selected Nodes section on the right.
    Note
    • In the Unselected Nodes section, you can select the primary node and all read-only nodes in the cluster.
    • The node selection does 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 contains only one node. However, when the read/write mode is set to Read Only, you cannot create a single-node cluster endpoint that contains only the primary node. For more information, see Read/write modes for cluster endpoints.
    Automatically Associate New Nodes Specifies whether a new node is automatically associated with the cluster endpoint.
    SLB Settings Load Balancing Policy The policy for scheduling read requests among multiple read-only nodes if read/write splitting is enabled. The default value of Load-based Automatic Scheduling is used. You cannot change the value of this parameter.
    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 Offload reads from the primary node.
    Note This parameter is available only if the read/write mode is set to Read and Write (Automatic Read-write Splitting) mode.
    Transaction Splitting Specifies whether to enable the transaction splitting feature. For more information, see Split transactions.
    Note You can configure this feature only if you set the read/write mode to Read and Write (Automatic Read-write Splitting) and set Consistency Level to Session Consistency (Medium) or Global Consistency (Strong).
    Consistency Settings Consistency Level
    • If you set the read/write mode to Read and Write (Automatic Read-write Splitting), the following consistency levels are available: Eventual Consistency (Weak), Global Consistency (Strong), and Session Consistency (Medium). For more information, see Consistency levels.
    • If you set the read/write mode to Read Only, the default value of Eventual Consistency (Weak) is used. You cannot change the value of this parameter.
    Note Changes to the consistency level immediately take effect on all connections.
    Global Consistency Timeout The timeout period of synchronizing the latest data to read-only nodes. Unit: milliseconds. Valid values: 0 to 6000. Default value: 20.
    Note This parameter is available only if you set Consistency Level to Global Consistency (Strong).
    Global Consistency Timeout Policy The default policy to be applied if global consistency is not achieved among the PolarDB read-only nodes within the specified timeout period. Valid values:
    • Send Requests to Primary Node (Default)
    • SQL Exception: Wait replication complete timeout, please retry.
    Note This parameter is available only if you set Consistency Level to Global Consistency (Strong).
    Connection Pool Settings Connection Pool You can select Off, Session-level, or Transaction-level. The default value is Off. For more information, see Connection pool.
    Note This parameter is available only if you set the read/write mode to Read and Write (Automatic Read-write Splitting).
    HTAP Optimization Parallel Query Specifies whether to enable the parallel query feature. For more information, see Parallel query.
    Note This parameter is available only if you set the read/write mode to Read Only for your custom cluster endpoint and the custom cluster endpoint is created for an ApsaraDB PolarDB MySQL-compatible edition cluster that runs MySQL 8.0.
  6. Click OK.

Related API operations

API Description
DescribeDBClusterEndpoints Queries the cluster endpoints of a specified PolarDB cluster.
ModifyDBClusterEndpoint Modifies the attributes of a specified PolarDB cluster endpoint.
DeleteDBClusterEndpoint Deletes a custom cluster endpoint of a specified PolarDB cluster.