This topic describes how to configure PolarProxy for a PolarDB cluster by modifying the configuration of the cluster endpoint.

Prerequisites

The edition of the PolarDB for MySQL cluster is Cluster Edition. Single Node and Archive Database are not supported. For more information, see Overview.

Precautions

  • You can enable hybrid transaction/analytical processing (HTAP) and configure the degree of parallelism only when you configure PolarProxy for a PolarDB for MySQL 8.0 cluster.

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 that you want to manage and click the cluster ID.
  4. In the Endpoints section on the Overview page, find the cluster endpoint that you want to modify and click Modify to the right 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. Parameters
    Parameter Description
    Network Information PolarDB provides a private endpoint for each cluster by default. You can modify the private endpoint or apply for a public endpoint. For more information, 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 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 associate with the cluster endpoint to process read requests from the Unselected Nodes list on the left. Then, click the 1 icon to add the nodes to the Selected Nodes list 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. For more information, see Read/write modes for cluster endpoints.
    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
    • If you set this parameter to No, read requests are sent only to read-only nodes to reduce the loads of the primary node.
    • If you set this parameter to Yes, read requests are sent to the primary node and read-only nodes.
    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).
    Transaction Splitting Specifies whether to enable the transaction splitting feature. For more information, see Split transactions.
    Note This parameter is available only if the read/write mode is set to Read and Write (Automatic Read-write Splitting).
    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), Session Consistency (Medium), and Global Consistency (Strong). 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.
    Global Consistency Timeout The timeout period of achieving global consistency among 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 PolarDB fails to achieve global consistency among 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 set the parameter to Off (default), Session-level, or Transaction-level. For more information about connection pools, see Connection pools.
    Note This parameter is available only if you set the read/write mode to Read and Write (Automatic Read-write Splitting).
    TAP Optimization Parallel Query Specifies whether to enable parallel computing and set the degree of parallelism. By default, the parallel computing feature is disabled. For more information, see Parallel query.
    Note This parameter is available only if the read/write mode of the custom cluster endpoint used by your cluster is Read Only and the cluster is a PolarDB for MySQL 8.0 cluster.
    Dynamic Data Masking You can create, enable, or disable data masking rules in the PolarDB console. For more information, see Manage data masking rules.
    Note To use dynamic data masking, the PolarProxy version of the PolarDB cluster must be V2.4.12 or later.
  6. Click OK.

Related API operations

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