All Products
Search
Document Center

PolarDB:Primary endpoints, cluster endpoints, and custom endpoints

Last Updated:Jul 09, 2024

PolarDB clusters support the following types of endpoints: primary endpoint, cluster endpoint (also known as the default cluster endpoint), and custom endpoint. Both cluster endpoints and custom endpoints are provided by PolarProxy. Requests to cluster endpoints and custom endpoints are processed by PolarProxy. Requests to primary endpoints are not processed by PolarProxy. You can use these types of endpoints of a PolarDB cluster to connect to a PolarDB cluster. We recommend that you use the default cluster endpoint. This topic describes the functions and differences of these types of endpoints.

Comparison between cluster endpoints and primary endpoints

image

Endpoint type

Description

Scenario

Supported network type

Default cluster endpoint (recommended)

Each PolarDB cluster supports only a single default cluster endpoint. The default cluster endpoint is provided by PolarProxy.

The default cluster endpoint supports automatic read/write splitting. Write requests are routed to the primary node and read requests are routed to read-only nodes. For more information about PolarProxy, see PolarProxy.

Businesses that require read/write splitting and real-time business scaling by adding read-only nodes.

  • Internal network

  • Internet

Custom endpoint

You can create up to six custom endpoints for a cluster. The custom endpoints are provided by the PolarProxy.

  • You can configure the read/write mode and load balancing policy for a custom endpoint to support both read/write splitting and read-only services. For more information, see Configure PolarProxy.

  • You can associate one or more read-only nodes to a custom endpoint. Requests that pass through this endpoint are all routed to this read-only node.

Note

You can associate only one node to a PolarDB custom endpoint. If the only node becomes faulty, the endpoint may be unavailable for up to 1 hour. We recommend that you associate more than one node with the cluster endpoint in production environments.

You can use custom endpoints to isolate the accesses from different businesses to cluster nodes. As shown in the preceding figure, exceptions in Read-only node 5 affects only Business Z.

You can set the read/write mode to Read Only mode to support only read-only services.

Primary endpoint

Each PolarDB cluster supports only a single primary endpoint. The primary endpoint has the following features:

  • The primary endpoint allows you to connect to the primary node of the cluster. The primary endpoint can be used for read and write operations.

  • When the primary node is unavailable, the primary endpoint is switched to the new primary node.

Scenarios that do not require read/write splitting.

Private endpoints and public endpoints

Network type

Description

Scenarios

Internal network

  • A PolarDB cluster achieves optimal performance when the cluster is connected by using an internal endpoint.

  • When you create a cluster, a default private endpoint is created. This endpoint can be modified but cannot be deleted. For more information, see Change the endpoint of an instance.

Examples:

  • If your Elastic Compute Service (ECS) instance is deployed in the same virtual private cloud (VPC) as the cluster, your ECS instance can connect to the cluster by using a private endpoint.

  • You can use Data Management (DMS) to connect to the cluster over a VPC.

Internet

  • You can apply for or delete a public endpoint. For more information, see Manage the endpoints of an instance.

  • A PolarDB cluster cannot achieve optimal performance when it is connected by using a public endpoint.

For example, you can connect to your cluster by using a public endpoint to perform O&M operations.

Read/write modes for cluster endpoints

You can set the read/write mode to Read/Write (Automatic Read/Write Splitting) or Read-only for a cluster endpoint. The following table describes the differences between cluster endpoints that use different read/write modes.

Note

For information about how to configure the read/write mode for a cluster endpoint, see Configure PolarProxy.

Item

Read/Write (Automatic Read/Write Splitting)

Read-only

Associated nodes

Nodes can be associated with the cluster endpoint in one of the following three configurations:

  • Only the primary node

  • One or more read-only nodes

  • The primary node and one or more read-only nodes

Note

In read and write mode:

  • All write requests are sent only to the primary node, regardless of whether the primary node is added to the list of service nodes.

  • For read requests, you can configure Primary Node Accepts Read Requests to specify whether the primary node processes read requests.

Only the following configuration is supported:

  • One or more read-only nodes

Note

In read-only mode:

  • Read requests are forwarded to read-only nodes in load balancing mode.

  • All read requests are not forwarded to the primary node. Even if the primary node is added to the list of service nodes, read requests are still not forwarded to it.

  • You cannot create a read-only cluster endpoint that contains only one primary node.

Load Balancing Policy

Active Request-based Load Balancing is supported.

For more information, see Load balancing policies.

Connections-based Load Balancing and Active Request-based Load Balancing are supported.

For more information, see Load balancing policies.

Primary Node Accepts Read Requests

Supported.

For more information, see Read/write splitting.

This feature is used to reduce the loads on the primary node. However, the primary node that is associated with a Read-only cluster endpoint does not process read or write requests. Therefore, this feature is redundant.

Transaction Splitting

Supported.

For more information, see Transaction splitting.

Note

This configuration is supported only if Consistency Level is set to Session Consistency (Medium) or Global Consistency (Strong).

This feature is used to reduce the loads on the primary node. However, the primary node that is associated with a Read-only cluster endpoint does not process read or write requests. Therefore, this feature is redundant.

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 pools.

Note
  • This connection pool feature is provided by PolarProxy of PolarDB. This feature does not affect the connection pool feature in your client. If the client provides a connection pool, you can set Connection Pool to Off in the PolarDB console to disable the connection pool feature of PolarProxy.

  • After you set Connection Pool to Off, PolarProxy sends a request from the client to all nodes that are associated with the cluster endpoint. These nodes include the primary node and the read-only nodes. The total number of available connections is limited by the maximum number of connections that can be established to the primary node.

Not supported.

Note

PolarDB evenly distributes requests among all read-only nodes that are associated with the Read-only cluster endpoint. The primary node does not process requests. PolarProxy sends a request from the client to only a single read-only node. The total number of available connections is equal to the sum of connections to all read-only nodes.

Security Protection

Supported.

For more information, see Overload protection.

Not supported.