All Products
Search
Document Center

PolarDB:Configure PolarProxy

更新時間:Sep 12, 2024

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

Prerequisites

The PolarDB for MySQL cluster is of Cluster Edition. For more information about the 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 upper-left corner, select the region in which the cluster is deployed.

  3. Find the cluster and click its ID.

  4. In the Database Connections section of the Basic Information page of the cluster, find the cluster endpoint and click Configure to the right of the endpoint name.

    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 private endpoint for each cluster endpoint. You can change the private endpoint or apply for a public endpoint. For more information, see Manage endpoints.

    Cluster Settings

    Read/Write

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

    Note

    You can change the read/write mode of a custom cluster endpoint after you create the cluster endpoint. After you change the read/write mode of a custom cluster endpoint, the new mode takes effect only for new connections. The original mode continues to take effect for existing connections.

    Endpoint Name

    The name of the custom cluster endpoint.

    Node Settings

    Available Nodes and Selected Nodes

    Select the nodes that you want to associate with the cluster endpoint 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 selected nodes to the Selected Nodes list on the right.

    Note

    The type of nodes that you select does not affect the read/write mode of the endpoint.

    • If you set the Read/Write parameter 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 parameter 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 load balancing read requests among read-only nodes. You can select Connections-based Load Balancing and Active Request-based Load Balancing based on your business requirements. For more information about load balancing policies, see Load balancing policies.

    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 Primary Node Accepts Read Requests.

    Note

    This parameter is available only if you set the Read/Write parameter to Read/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 parameter to Read/Write (Automatic Read/Write Splitting).

    On-demand Connections

    Specifies whether to enable on-demand connections. For more information, see On-demand connections.

    Note

    This parameter is available only if you set the Load Balancing Policy parameter to Active Request-based Load Balancing.

    Consistency Settings

    Consistency Level

    • If you set the Read/Write parameter 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 parameter to Read-only, the consistency level is Eventual Consistency (Weak) by default and cannot be changed.

    Note

    Changes to the consistency level immediately take effect on all connections.

    Global Consistency Timeout

    The maximum period of time during which PolarProxy waits for all read-only nodes to update to the latest LSN on the primary node after PolarProxy receives a read request. 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 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 the Consistency Level parameter to Global Consistency (Strong).

    Session Consistency Timeout

    The maximum duration that PolarProxy waits for the read-only nodes in a session to synchronize with the latest session LSN after PolarProxy receives a read request on the session. Valid values: 0 to 60000. Default value: 0. Unit: milliseconds.

    Note

    This parameter is available only if you set the Consistency Level parameter to Session Consistency (Medium).

    Session Consistency Timeout Policy

    The default policy that you want to apply if session 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 Session Consistency (Medium).

    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 parameter 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 ePQ 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 whose revision version 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.