All Products
Search
Document Center

PolarDB:Configure PolarProxy

Last Updated:Apr 11, 2024

This topic describes how to configure PolarProxy for a PolarDB cluster by configuring the cluster endpoint.

Prerequisites

The cluster must be of PolarDB for MySQL Cluster Edition or X-Engine Edition. You cannot configure PolarProxy for a Single Node Edition cluster. For more information about cluster editions, see Editions.

Usage notes

You can enable the parallel query feature and specify 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 top navigation bar, select the region in which the cluster that you want to manage is deployed.

  3. Find the cluster and click its ID.

  4. On the Basic Information page, find the cluster endpoint in the Database Connections section and click Configure.

    7.png

  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 that you can configure.

    Table 1. Parameters

    Parameter

    Description

    Network Information

    By default, PolarDB provides a virtual private cloud (VPC) endpoint for each cluster. You can change the VPC endpoint or apply for a public endpoint. For more information, see Manage the endpoints of a cluster.

    Cluster Settings

    Read/Write

    The read/write mode of the cluster endpoint. You can select Read-only or Read/Write (Automatic Read/Write Splitting).

    Note

    You can change the read/write mode of a custom cluster endpoint after you add the cluster endpoint. After you change the read/write mode, the new mode takes effect only on new connections. Existing connections remain 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 associate with the cluster endpoint to process read requests from the Available Nodes list on the left. The Available Nodes list contains the primary node and all read-only nodes. Then, click the 1 icon to add the nodes to the Selected Nodes list on the right.

    Note

    The type of nodes that you select does 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 added to the Selected Nodes list.

    • If you set the read/write mode to Read-only, all read requests are forwarded to read-only nodes in load balancing mode. Read requests are not forwarded to the primary node even if the primary node is added to the Selected Nodes list.

    Automatically Associate New Nodes

    Specifies whether to automatically associate a new node with the cluster endpoint.

    Load Balancing Settings

    Load Balancing Policy

    The policy for scheduling read requests among read-only nodes when read/write splitting is enabled. Valid values: Connections-based Load Balancing and Active Request-based Load Balancing. For more information about load balancing policies, see the "Load balancing policies" section in the Load balancing topic.

    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 the "Primary Node Accepts Read Requests" section in the Load balancing topic.

    Note

    This parameter is available only if you set the read/write mode to Read/Write (Automatic Read/Write Splitting).

    Transaction Splitting

    Specifies whether to enable the transaction splitting feature. For more information, see the "Transaction splitting" section in the Load balancing topic.

    Note

    This parameter is available only if you set the read/write mode to Read/Write (Automatic Read/Write Splitting).

    On-demand Connections

    Specifies whether to enable on-demand connections. For more information about on-demand connections, see the "On-demand connections" section in the Load balancing topic.

    Note

    This parameter is available only if you select Active Request-Based Load Balancing for the Active Request-based Load Balancing parameter.

    Consistency Settings

    Consistency Level

    • If you set the read/write mode to Read/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 for updating the log sequence numbers (LSNs) of read-only nodes to the latest LSN of the primary node. Valid values: 0 to 60000. Default value: 20. Unit: milliseconds.

    Note

    This parameter is available only if you set the Consistency Level parameter to Global Consistency (Strong).

    Global Consistency Timeout Policy

    The default policy that you want to apply if global consistency fails to be achieved among the PolarDB read-only nodes within the specified 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 the Consistency Level parameter to Global Consistency (Strong).

    Connection Pool Settings

    Connection Pool

    Valid values: Off, Session-level, and Transaction-level. Default value: Off. For more information about connection pools, see Connection pools.

    Note

    This parameter is available only if you set the read/write mode to Read/Write (Automatic Read/Write Splitting).

    HTAP Optimization

    Parallel Query

    Specifies whether to enable the parallel query feature and specifies the degree of parallelism.

    The elastic parallel query (ePQ) feature can effectively use multi-core CPUs and idle computing resources in a cluster to accelerate complex queries. For more information, see Overview.

    Note

    Starting from April 1, 2023, the ePQ feature is automatically enabled for a cluster if the cluster meets the following conditions. The default degree of parallelism is 2.

    • For a new cluster, the number of CPU cores is greater than or equal to 8.

    • For an existing cluster, a custom cluster endpoint is created, and the number of CPU cores is greater than or equal to 8.

    Transactional/Analytical Processing Splitting

    Specifies whether to enable automatic request distribution among row store and column store nodes. For more information, see Automatic request distribution among row store and column store nodes.

    Note

    This parameter is available only if the following requirements are met: The cluster runs PolarDB for MySQL 8.0.1 and the revision version of the cluster is 8.0.1.1.22 or later. The cluster endpoint is in Read/Write (Automatic Read/Write Splitting) mode. The Selected Nodes list in the Node Settings section contains at least one read-only column store node.

    Column store nodes handle OLTP requests

    Specifies whether to allow column store nodes to handle online transaction processing (OLTP) requests.

    If column store nodes are allowed to handle OLTP requests, the nodes receive both online analytical processing (OLAP) and OLTP requests. PolarProxy routes OLTP read requests to column store nodes based on the number of active requests. This may increase the loads on the column store nodes.

    Note

    This parameter is available only if you enable Transactional/Analytical Processing Splitting.

    Security Protection

    Overload Protection

    Specifies whether to enable the overload protection feature. For more information, see Overload protection.

  6. Click OK.

Related API operations

Operation

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.