You can create custom cluster endpoints for PolarDB for PostgreSQL clusters. When you create custom cluster endpoints, you can specify the read/write mode, consistency level, and associated read-only nodes to meet your business requirements and improve service flexibility. This topic describes how to create custom cluster endpoints for PolarDB for PostgreSQL clusters.
- Log on to the PolarDB console.
- On the top of the page, select the region where the target cluster is located.
- Find the target cluster and click the cluster ID to go to the Overview page.
- In the Endpoints section, click Create Custom Cluster Endpoint.
- In the Create Custom Cluster Endpoint dialog box, set the following parameters.
Parameter Description Read/write Mode The read/write mode of the endpoint to be created. You can set this parameter to Read Only or Read and Write (Automatic Read-write Splitting).Note You can change the read/write mode after you create the custom cluster endpoint. After you change the read/write mode, the existing connections are closed. Make sure that your application can automatically reconnect to the PolarDB for PostgreSQL cluster. Reader Nodes The nodes that you associate with the cluster endpoint to process read requests. You can select the primary node and read-only nodes in the Unselected Nodes section on the left side of the dialog box.Note
- If the read/write mode is set to Read and Write (Automatic Read-write Splitting), you must select at least two nodes. The selected nodes must include the primary node.
- If the read/write mode is set to Read Only, you can select one or more nodes. You can also create single-node endpoints based on your business requirements. For more information, see FAQ.
Automatically Associate New Nodes Specifies whether a new node is automatically associated with the cluster endpoint. Load Balancing Policy The policy for scheduling read requests among multiple read-only nodes if read/write splitting is enabled. The default value is Load-based Automatic Scheduling and cannot be changed. Consistency Level
- If the read/write mode is set to Read and Write (Automatic Read-write Splitting), the consistency level options are Eventual Consistency and Session Consistency (Recommended). For more information, see Consistency levels.
- If the read/write mode is set to Read Only, the default consistency level is Eventual Consistency and cannot be changed.
Offload Reads from Primary Node After this feature is enabled, SQL query statements are sent only to read-only nodes. This reduces the loads on the primary node and ensures the stability of the primary node.Note You can configure this feature only after you set the read/write mode to Read and Write (Automatic Read-write Splitting). Transaction Splitting Specifies whether to enable the transaction splitting feature. For more information, see Configure transaction splitting.Note You can configure this feature only after you set the read/write mode to Read and Write (Automatic Read-write Splitting).
- Click OK.
- Question: How do I create a single-node endpoint?
Answer: You can create a single-node endpoint only if the read/write mode is set to Read Only and the cluster has at least three nodes. When you create a single-node endpoint, you can select only read-only nodes as reader nodes. The reader nodes are the backend nodes that handle read requests. For more information, see Procedure.Warning However, if you create a single-node endpoint for a read-only node and the read-only node becomes faulty, the single-node endpoint may be unavailable for up to 1 hour. We recommend that you do not create single-node endpoints in the production environment.
- Question: What is the maximum number of single-node endpoints that I can create for
Answer: The maximum number of the single-node endpoints that are allowed in a cluster varies based on the number of nodes in the cluster. If your cluster has three nodes, you can create a single-node endpoint for only one of the read-only nodes. If your cluster has four nodes, you can create two single-node endpoints for two of the read-only nodes, one for each read-only node. Similar rules apply if your cluster has five or more nodes.
- Question: If a single-node endpoint is created for a read-only node, can the read-only
node function as the new primary node during a failover in case of a system exception?
Answer: No, the read-only node that has a single-node endpoint configured cannot automatically function as the new primary node during a failover. However, you can manually specify the read-only node as the new primary node. For more information, see Switch workloads from writer nodes to reader nodes.
- Question: What is the maximum number of cluster endpoints that a cluster can have?
Answer: A cluster can have a maximum of four cluster endpoints, one of which is the default cluster endpoint and the other three are custom cluster endpoints.
- Question: Can I modify a cluster endpoint?
Answer: Yes, you can modify the default cluster endpoint and the custom cluster endpoints. For more information, see Modify a cluster endpoint.
- Question: Can I delete a cluster endpoint?
Answer: Yes, you can delete a cluster endpoint. However, you can delete only custom cluster endpoints, and you cannot delete the default cluster endpoint. For more information, see Delete a custom cluster endpoint.
|CreateDBClusterEndpoint||Creates a custom cluster endpoint for a PolarDB for PostgreSQL cluster.|
|DescribeDBClusterEndpoints||Queries cluster endpoints for a PolarDB for PostgreSQL cluster.|