This topic describes how to configure PolarProxy using a PolarDB cluster endpoint.
Prerequisites
The product edition must be PolarDB for MySQL Cluster Edition. For more information about product editions, see Enterprise Edition.
Usage notes
You can configure parallel query and set its degree of parallelism for PolarProxy only on PolarDB for MySQL 8.0 clusters.
Procedure
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the region where your cluster is deployed, and then click the target cluster ID.
-
On the Basic Information page, in the Database Connections section, find the target cluster endpoint and click Configure to the right of the endpoint name.
-
In the dialog box that appears, modify the cluster endpoint settings as needed. The following table describes the parameters.
Table 1. Configuration parameters
Parameter
Description
Network Information
By default, PolarDB assigns a private endpoint to each cluster endpoint. To modify the private endpoint or apply for a public endpoint, see Manage endpoints.
Cluster Settings
Read/Write
The read/write mode of the cluster endpoint. Valid values: Read-only and Read/Write (Automatic Read/Write Splitting).
NoteYou can modify the read/write mode after you create a custom endpoint. The new mode takes effect only for new connections. Existing connections are not affected.
Endpoint Name
Enter a name for the cluster endpoint.
Node Settings
Available Nodes and Selected Nodes
The Available Nodes box lists the primary node and all read-only nodes. Select the nodes to handle read requests and move them to the Selected Nodes box by clicking the
icon.NoteNode selection does not affect the read/write mode:
-
If the read/write mode is set to Read/Write (Automatic Read/Write Splitting), write requests are always sent to the primary node, regardless of whether it is in the Selected Nodes box.
-
If the read/write mode is set to Read-only, all read requests are distributed among the selected read-only nodes. Requests are not sent to the primary node, even if it is included in the Selected Nodes box.
-
If the read/write mode is Read/Write (Automatic Read/Write Splitting), multi-primary clusters (Limitless) use a database/table-based routing mechanism. You must add the primary nodes that host the target databases or tables to the read/write endpoint, or select all primary nodes. Evaluate the routing impact before you select nodes.
Automatically Associate New Nodes
Specifies whether to automatically add new nodes to this endpoint.
Load Balancing Settings
Load Balancing Policy
The scheduling policy for distributing read requests across multiple nodes when read/write splitting is enabled. Valid values: Connections-based Load Balancing and Active Request-based Load Balancing. For more information, see Load balancing policies.
Primary Node Accepts Read Requests
-
Select No. Queries are sent only to read-only nodes. This reduces the load on the primary node and ensures its stability.
-
Select Yes. Queries can be sent to both the primary node and read-only nodes.
For more information, see Primary node accepts read requests.
NoteThis setting is available only in Read/Write (Automatic Read/Write Splitting) mode.
Transaction Splitting
Enables or disables transaction splitting. For more information, see Transaction splitting.
NoteThis setting is available only in Read/Write (Automatic Read/Write Splitting) mode.
On-demand connections
Enables or disables on-demand connections. For more information, see On-demand connections.
NoteThis setting is available only when the Load balancing policy is set to Active Request-based Load Balancing.
Consistency Settings
Consistency Level
-
If the read/write mode is Read/Write (Automatic Read/Write Splitting), you can select Eventual Consistency (Weak), Session Consistency (Medium), or Global Consistency (Strong). For more information, see Consistency levels.
-
If the read/write mode is Read-only, the consistency level is fixed at Eventual Consistency (Weak).
Important-
Changes to the consistency level take effect immediately for all connections.
-
Enabling this mode for one endpoint enables it for all endpoints in the cluster. Disabling it reverts all endpoints to their previously configured consistency levels.
-
The consistency level settings are displayed only when the cluster has at least one read-only (RO) node. If the cluster has no read-only nodes, this section is not displayed.
Global Consistency Timeout
The timeout period for a read-only node to wait for data synchronization from the primary node. Valid values: 0 to 60,000. Default value: 20. Unit: ms.
NoteThis parameter is available only when Consistency Level is set to Global Consistency (Strong) and Global Consistency Mode is set to Traditional Mode.
Global Consistency Timeout Policy
The policy PolarDB applies when a read-only node times out. Valid values:
-
Send Requests to Primary Node (Default)
-
SQL Exception: Wait replication complete timeout, please retry.
NoteThis parameter is available only when Consistency Level is set to Global Consistency (Strong) and Global Consistency Mode is set to Traditional Mode.
Global consistency read timeout (high-performance mode)
The timeout period for a read-only node to wait for data synchronization from the primary node. Valid values: 1 to 1,000,000. Default value: 100. Unit: ms.
Important-
Global consistency (high-performance mode) applies to all endpoints in a cluster. When you enable this mode for one endpoint, it is enabled for all.
-
This parameter is available only when Consistency Level is set to Global Consistency (Strong) and Global Consistency Mode is set to High-performance Mode.
Global consistency read timeout policy (high-performance mode)
The policy that PolarDB applies after a timeout occurs on a read-only node. Valid values:
-
Send Requests to Primary Node (Default)
-
Return error messages due to timeout.
-
Downgrade the consistency level of a query to inconsistent read when a global consistent read in the query times out. No error message is returned to the client.
NoteThis parameter is available only when Consistency Level is set to Global Consistency (Strong) and Global Consistency Mode is set to High-performance Mode.
Session Consistency Timeout
The timeout period for a read-only node to wait for data synchronization from the primary node. Valid values: 0 to 60,000. Default value: 0. Unit: ms.
Important-
This parameter is available only when Consistency Level is set to Session Consistency (Medium).
Session Consistency Timeout Policy
The policy that PolarDB applies after a timeout occurs on a read-only node. Valid values:
-
Send Requests to Primary Node (Default)
-
SQL Exception: Wait replication complete timeout, please retry.
NoteThis parameter is available only when Consistency Level is set to Session Consistency (Medium).
Connection Pool Settings
Connection Pool
You can select Off (default), Session-level, or Transaction-level. For more information, see Connection pools.
Note-
This setting is available only in Read/Write (Automatic Read/Write Splitting) mode.
-
These changes take effect only for new connections. To apply them to existing sessions, restart your application or re-establish its database connections.
HTAP Optimization
Parallel Query
Enables or disables the parallel query feature and sets the degree of parallelism.
Enabling elastic parallel query (ePQ) utilizes the parallel processing power of multi-core CPUs (idle computing resources in the cluster) to accelerate complex queries. For more information, see Elastic parallel query.
NoteStarting from April 1, 2023, elastic parallel query is enabled by default with a degree of parallelism of 2 if a cluster meets the following conditions:
-
For a new cluster: The cluster has 8 or more CPU cores.
-
For an existing cluster: A custom cluster endpoint is created for an existing cluster that has 8 or more CPU cores.
Transactional/Analytical Processing Splitting
Enables or disables transactional/analytical processing splitting. For more information, see Configure transactional/analytical processing splitting.
NotePolarDB for MySQL 8.0.1 clusters with minor engine version 8.0.1.1.22 or later support this setting only when the cluster endpoint is in Read/Write (Automatic Read/Write Splitting) mode and the Selected Nodes box under Node Settings contains at least one read-only column-store node.
Column store nodes handle OLTP requests.
Specifies whether to allow column-store nodes to accept OLTP requests.
If enabled, column-store nodes handle both OLAP and OLTP requests. The database proxy routes OLTP read requests to column-store nodes based on the number of active requests, which may increase the load on these nodes.
NoteThis setting is available only when Transactional/Analytical Processing Splitting is enabled.
Security Protection
Overload Protection
Enables or disables the overload protection feature. For more information, see Overload protection.
-
-
Click OK.
FAQ
API reference
|
API |
Description |
|
Queries cluster endpoints. |
|
|
Modifies a cluster endpoint. |
|
|
Deletes a custom cluster endpoint. |