You can connect to PolarDB cluster endpoints and use the features of the database proxy. A PolarDB cluster supports up to 4 cluster endpoints. You can modify the read and write mode of a cluster endpoint and add specific nodes to the cluster endpoint to meet your business requirements and improve service flexibility.

Considerations

  • A PolarDB cluster supports up to 4 cluster endpoints.
  • PolarDB allows you to create single-node cluster endpoints. If the node becomes unavailable, the single-node endpoint may be unavailable for up to 1 hour. We recommend that you do not use single-node endpoints in your production environment. For more information, see The read and write mode.

Scenarios

  • PolarDB cluster endpoints are applicable to businesses that requires request splitting. You can use different cluster endpoints to connect your services to the PolarDB cluster based on your business requirements.
  • You can set the read and write mode to Read and Write (Automatic Read-write Splitting) or Read Only for a cluster endpoint. Therefore, cluster endpoints are also applicable to services with only read requests.

For example, you have purchased a PolarDB cluster that contains one primary node and four read-only nodes. You want to connect Service A (read-only) and Service B (read and write) to this cluster. You can create a Custom Cluster Endpoint A (Read Only mode), which is associated with Read-only Node 1 and Read-only Node 2 and is provided to Service A. Then, create a Custom Cluster Endpoint B (Read and Write (Automatic Read-write Splitting) mode), which is associated with Read-only Node 3 and Read-only Node 4 and is provided to Service B. This allows you to physically isolate databases and minimizes the impacts on services.

The read and write mode

You can set the read and write mode to Read and Write (Automatic Read-write Splitting) or Read Only for a cluster endpoint. The following table describes the differences between cluster endpoints in the two modes.

Item Read and Write (Automatic Read-write Splitting) Read Only
Nodes Nodes are selected in the following ways:
  • Only the primary node.
  • Only one or more read-only nodes.
  • The primary node and read-only nodes.
Note
  • Write requests are sent to only the primary node, regardless of whether the cluster endpoint in this mode contains the primary node.
  • For read requests, you can set Offload Reads from Primary Node to specify whether the primary node processes read requests.
Nodes are selected in the following ways:
  • Only one or more read-only nodes.
  • The primary node and read-only nodes.
Note
  • You cannot create a cluster endpoint that contains only one primary node in Read Only mode.
  • Write requests are not sent to cluster endpoints in Read Only mode, regardless of whether the cluster endpoints contain the primary node. You must connect to a cluster endpoint in Read and Write (Automatic Read-write Splitting) mode to send write requests to the primary node.
Offload Reads from Primary Node Supported.

For more information, see Offload reads from the primary node.

This feature is used to reduce the loads of the primary node. However, the primary node of a Read Only cluster endpoint does not process read and write requests. Therefore, this feature is not required.
Transaction Splitting Supported.

For more information, see Transaction splitting.

Note This setting takes effect only when Consistency Level is set to Session Consistency (Medium) or Global Consistency (Strong).
This feature is used to reduce the loads of the primary node. However, the primary node of a Read Only cluster endpoint does not process read and write requests. Therefore, this feature is not required.
Consistency Level Eventual Consistency (Weak), Session Consistency (Medium), and Global Consistency (Strong) are supported.

For more information, see Consistency levels.

This parameter is set to Eventual Consistency (Weak). The cluster endpoint in this mode does not process write requests.
Connection Pool Session-level and Transaction-level connection pools are supported.

For more information, see Connection pool.

Note
  • This refers to the connection pool feature provided by PolarDB PolarProxy. This feature does not affect the connection pool feature in your clients. If the client provides a connection pool, you can Off the connection pool feature of PolarProxy.
  • After you Off the connection pool feature of PolarProxy, a request from the client is sent to all nodes. These nodes include the primary node and the read-only nodes that are attached to the cluster endpoint by using PolarProxy. The total number of available connections is limited by the maximum number of connections of the primary node.
Not supported.
Note PolarDB evenly distributes requests among all read-only nodes of the Read Only cluster endpoint. The primary node does not process requests. A request from the client is sent to only one read-only node through PolarProxy. The total number of available connections equals the total number of connections on all read-only nodes.
Parallel Query Not supported. This avoids adverse effects on the primary node. Supported. For more information, see Parallel query.