You can modify the default cluster endpoint and custom cluster endpoints for PolarDB-O clusters. When you modify the 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.

Procedure

  1. Log on to the PolarDB console.
  2. On the top of the page, select the region where the target cluster is located.
  3. Find the target cluster and click the cluster ID to go to the Overview page.
  4. In the Endpoints section, find the cluster endpoint that you want to modify, and on the right of the cluster endpoint, choose Modify > Modify.
    Modify a cluster endpoint
  5. In the Configure Nodes dialog box, set the following parameters.
    Parameter Description
    Read/write Mode The read/write mode for the custom cluster endpoint. Read Only and Read and Write (Automatic Read-write Splitting) are available.
    Note After you modify the read/write mode, existing connections to the cluster endpoint are closed. Make sure that your applications can automatically reconnect to the PolarDB-O 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.
    Note
    • If you set Read/write Mode to Read and Write (Automatic Read-write Splitting), you must select at least two nodes, including the primary node.
    • When the read/write mode is set to Read Only, you can create single-node endpoints. 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 one hour. We recommend that you do not create single-node endpoints in your production environment. We recommend that you select at least two nodes for processing read requests to improve cluster availability.
    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 you set Read/write Mode to Read and Write (Automatic Read-write Splitting), the following consistency levels are available: Eventual Consistency and Session Consistency (Recommended). For more information, see PolarDB-O 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 to only read-only nodes. This reduces the load on the primary node and ensures the stability of the primary node.
    Note You can configure this feature only after you set 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 Read/write Mode to Read and Write (Automatic Read-write Splitting).
  6. Click OK.

Related operations

API Description
DescribeDBClusterEndpoints Queries cluster endpoints for an Apsara PolarDB cluster.
ModifyDBClusterEndpoint Modifies a cluster endpoint for an Apsara PolarDB cluster.