Configure the database proxy
Configure the database proxy by using the cluster endpoint of PolarDB.
Prerequisites
The product edition must be PolarDB for MySQLCluster Edition. For more information about product editions, see Enterprise editions.
Usage notes
Only PolarDB for MySQL 8.0 clusters support enabling parallel query and setting the degree of parallelism when you configure the database proxy.
Procedure
Log on to the PolarDB console. In the left-side navigation pane, click Clusters, select the region where the cluster is located, and then click the ID of the target cluster to go to the cluster details page.
On the Basic Information page of the cluster, find the target cluster endpoint in the Database Connections section, and click Configure to the right of its name.
In the dialog box that appears, modify the cluster endpoint settings as needed. The following table describes the configuration items.
Table 1. Configuration parameters
Parameter
Description
Network Information
PolarDB provides a private endpoint for each cluster endpoint by default. To modify this endpoint or apply for a public endpoint, see Manage endpoints.
Cluster Settings
Read/Write
The read/write mode of the cluster endpoint. Valid modes are Read-only and Read/Write (Automatic Read/Write Splitting).
NoteYou can modify the read/write mode after you create a custom endpoint. After you change the read/write mode, the change takes effect only for new connections. Existing connections keep the original mode.
Endpoint Name
Enter a name for the cluster endpoint.
Node Settings
Available Nodes and Selected Nodes
The Available Nodes box on the left includes the primary node and all read-only nodes. Select the nodes that you want to add to the cluster endpoint to handle read requests, and click the
icon to move them to the Selected Nodes box on the right.NoteNode selection does not affect the read/write mode:
When the read/write mode is Read/Write (Automatic Read/Write Splitting), write requests are sent only to the primary node, regardless of whether the primary node is selected in Selected Nodes.
When the read/write mode is Read-only, all read requests are forwarded to read-only nodes by load balancing and are not forwarded to the primary node. Even if the primary node is added to Selected Nodes, this does not take effect.
When the read/write mode is Read/Write (Automatic Read/Write Splitting), because multi-primary clusters (Limitless) use a database and table routing mechanism, add the primary node of the target database and table to the read/write endpoint, or select all primary nodes. Fully 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 used to process read requests across multiple nodes during read/write splitting. Valid policies are Connections-based Load Balancing and Active Request-based Load Balancing. For more information about the load balancing policy, see Load balancing policies.
Primary Node Accepts Read Requests
Select No. SQL queries are sent only to read-only nodes, which reduces the load on the primary node and keeps the primary node stable.
Select Yes. SQL queries can be sent to the primary node and read-only nodes.
For more information about whether the primary database accepts read requests, see Primary node accepts read requests.
NoteThis setting is supported only in Read/Write (Automatic Read/Write Splitting) mode.
Transaction Splitting
Enable or disable transaction splitting. For more information about transaction splitting, see Transaction splitting.
NoteThis setting is supported only in Read/Write (Automatic Read/Write Splitting) mode.
On-demand connections
Enable or disable on-demand connections. For more information about on-demand connections, see On-demand connections.
NoteThis setting is supported only when Load balancing policy is Active Request-based Load Balancing.
Consistency Settings
Consistency Level
When the read/write mode is Read/Write (Automatic Read/Write Splitting), the available consistency levels are Eventual Consistency (Weak), Session Consistency (Medium), and Global Consistency (Strong). For more information, see Consistency levels.
When the read/write mode is Read-only, the default consistency level is Eventual Consistency (Weak) and cannot be changed.
ImportantThe consistency settings are displayed only when the cluster contains at least one read-only node (RO). If the cluster contains no read-only nodes, this section is not displayed.
Changes to the consistency level take effect immediately for all connections.
Global consistency (high-performance mode) must take effect on all endpoints in the cluster at the same time. If you select a consistency level other than global consistency (high-performance mode), all other endpoints in the cluster revert to the consistency state that was in effect before global consistency (high-performance mode) was enabled.
Global Consistency Timeout
The timeout period for a read-only node to synchronize with the latest data. Valid values: 0 to 60,000. Default value: 20. Unit: ms.
NoteThis setting is supported only when Consistency Level is Global Consistency (Strong) and Global Consistency Mode is Traditional Mode.
Global Consistency Timeout Policy
The default policy that PolarDB applies after a read-only node times out. Valid values:
Send Requests to Primary Node (Default)
SQL Exception: Wait replication complete timeout, please retry.
NoteThis setting is supported only when Consistency Level is Global Consistency (Strong) and Global Consistency Mode is Traditional Mode.
Timeout for global consistency reads (high-performance mode)
The timeout period for a read-only node to synchronize with the latest data. Valid values: 1 to 1,000,000. Default value: 100. Unit: ms.
ImportantGlobal consistency (high-performance mode) must take effect on all endpoints in the cluster at the same time. If you enable global consistency (high-performance mode) for one endpoint, it is enabled for all other endpoints in the cluster.
This setting is supported only when Consistency Level is Global Consistency (Strong) and Global Consistency Mode is High-performance Mode.
Policy for global consistency read timeouts (high-performance mode)
The default policy that PolarDB applies after a read-only node times out. 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 setting is supported only when Consistency Level is Global Consistency (Strong) and Global Consistency Mode is High-performance Mode.
Session Consistency Timeout
The timeout period for a read-only node to synchronize with the latest data. Valid values: 0 to 60,000. Default value: 0. Unit: ms.
ImportantThis setting is supported only when Consistency Level is Session Consistency (Medium).
Global consistency (high-performance mode) must take effect on all endpoints in the cluster at the same time. If you select a consistency level other than global consistency (high-performance mode), all other endpoints in the cluster revert to the consistency state that was in effect before global consistency (high-performance mode) was enabled.
Session Consistency Timeout Policy
The default policy that PolarDB applies after a read-only node times out. Valid values:
Send Requests to Primary Node (Default)
SQL Exception: Wait replication complete timeout, please retry.
NoteThis setting is supported only when Consistency Level is Session Consistency (Medium).
Connection Pool Settings
Connection Pool
You can select Off (default), Session-level, or Transaction-level. For more information about the connection pool, see Connection pools.
NoteThis setting is supported only when the read/write mode is Read/Write (Automatic Read/Write Splitting).
Changes to the connection pool configuration take effect only for newly established connections. Usually, to make the changes take effect, restart the application or re-establish the connection to the database.
HTAP Optimization
Parallel Query
Enable or disable parallel query and set the degree of parallelism.
Elastic Parallel Query (ePQ) uses the parallel processing capability of multi-core CPUs (idle compute resources in the cluster) to accelerate complex queries. For more information, see Elastic Parallel Query.
NoteStarting April 1, 2023, Elastic Parallel Query is enabled by default and the degree of parallelism defaults to 2 for clusters that meet the following conditions:
Newly created clusters: the cluster has at least 8 CPU cores.
Existing clusters: you create a custom cluster endpoint in the cluster, and the cluster has at least 8 CPU cores.
Transactional/Analytical Processing Splitting
Enable or disable automatic traffic redirection between row store nodes and column store nodes. For more information, see Configure automatic request distribution.
NotePolarDB for MySQL 8.0.1 cluster endpoints with a minor engine version of 8.0.1.1.22 or later support this setting only in Read/Write (Automatic Read/Write Splitting) mode. In addition, Node Settings must include at least one read-only column store node in Selected Nodes.
Column store nodes handle OLTP requests.
Enable or disable the ability of column store nodes to handle OLTP requests.
After this feature is 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 column store nodes.
NoteThis setting is supported only when Transactional/Analytical Processing Splitting is enabled.
Security Protection
Overload Protection
Enable or disable overload protection. For more information, see Overload protection.
Click OK.
FAQ
API reference
API | Description |
Queries cluster endpoints. | |
Modifies cluster endpoints. | |
Releases custom cluster endpoints. |