All Products
Search
Document Center

PolarDB:Configure PolarProxy

Last Updated:Sep 10, 2024

PolarProxy provides read/write splitting, transaction splitting, and consistency level features. This topic describes how to configure these PolarProxy features when you create or modify a custom cluster endpoint.

Create a custom cluster endpoint

  1. Log on to the PolarDB console.

  2. In the upper-left corner, select the region in which the cluster is deployed.

  3. Find the cluster and click its ID.

  4. In the Database Connections section of the Basic Information page of the cluster, click Create Custom Cluster Endpoint.

  5. In the Create Custom Cluster Endpoint dialog box, configure the parameters. The following table describes the parameters.

    Table 1. Parameters

    Parameter

    Description

    Network Information

    By default, PolarDB provides a private endpoint for each cluster endpoint. You can change the private endpoint or apply for a public endpoint. For more information, see Manage an endpoint or Apply for an endpoint.

    Cluster Settings

    Read/Write

    The read/write mode of the custom cluster endpoint. Valid values: Read-only and Read/Write (Automatic Read/Write Splitting).

    Note

    You can change the read/write mode of a custom cluster endpoint after you create the cluster endpoint. After you change the read/write mode of a custom cluster endpoint, the new mode takes effect only for new connections. The original mode continues to take effect for existing connections.

    Endpoint Name

    The name of the custom cluster endpoint.

    Node Settings

    Available Nodes and Selected Nodes

    Select the nodes that you want to associate with the cluster endpoint from the Available Nodes list on the left. Then, click the 1 icon to add the nodes to the Selected Nodes list on the right.

    Note
    • The Available Nodes list contains the primary node and all read-only nodes.

    • The types of nodes that you select do not affect the read/write mode of the cluster endpoint. If you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting), write requests are sent only to the primary node regardless of whether the primary node is selected.

    • PolarDB allows you to create a cluster endpoint that is associated with only the primary node. However, if you set the Read/Write parameter to Read-only, you cannot create a cluster endpoint that is associated only with the primary node

    Automatically Associate New Nodes

    Specifies whether to automatically associate a new node with the cluster endpoint.

    Load Balancing Settings

    Load Balancing Policy

    • If you set the Read/Write parameter to Read-only, valid values are Connections-based Load Balancing and Active Request-based Load Balancing.

    • If you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting), the parameter value is Active Request-based Load Balancing by default and cannot be changed.

    Primary Node Accepts Read Requests

    If you set the Primary Node Accepts Read Requests parameter to No, SQL query requests are sent only to read-only nodes. This reduces the loads on the primary node and ensures the service stability of the primary node. For more information about protection for the primary node, see Read/write splitting.

    Note

    This parameter is available only if you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting).

    Transaction Splitting

    Specifies whether to enable the transaction splitting feature. For more information, see Transaction splitting.

    Note

    This parameter is available only if you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting).

    Consistency Settings

    Consistency Level

    • If you set the Read/Write parameter to Read/Write (Automatic Read/Write Splitting), the following consistency levels are available: Eventual Consistency (Weak) and Session Consistency (Medium). For more information, see Consistency levels.

    • If you set the Read/Write parameter to Read-only, the consistency level is Eventual Consistency (Weak) by default and cannot be changed.

    Note

    Changes to the consistency level immediately take effect on all connections.

    Connection Pool Settings

    Connection Pool

    Selects Off (default) to disable the connection pool feature or Transaction-level to enable the transaction-level connection pool feature based on your business requirements. Transaction-level connection pools can help reduce high database load caused by a large number of connections. For more information, see Transaction-level connection pools.

  6. Click OK.

Modify a custom cluster endpoint

  1. Log on to the PolarDB console.

  2. In the upper-left corner, select the region in which the cluster is deployed.

  3. Find the cluster and click its ID.

  4. In the Database Connections section of the Basic Information page of the cluster, find the cluster endpoint that you want to modify and click Configure to the right of the endpoint name.

  5. In the Modify Endpoint Settings dialog box, configure the parameters. For more information, see Custom cluster endpoint parameter settings.

  6. Click OK.

Release a custom cluster endpoint

Note
  • You can release only custom cluster endpoints. You cannot release the default cluster endpoint.

  • After you release a custom cluster endpoint, you cannot restore it, and you must change the cluster endpoint of your application at the earliest opportunity.

  1. Log on to the PolarDB console.

  2. In the upper-left corner, select the region in which the cluster is deployed.

  3. Find the cluster and click its ID.

  4. In the Database Connections section of the Basic Information page of the cluster, find the cluster endpoint that you want to release and click Release to the right of the endpoint name.

  5. In the dialog box that appears, click OK.

Related API operations

Operation

Description

CreateDBClusterEndpoint

Creates a custom cluster endpoint for a PolarDB cluster.

DescribeDBClusterEndpoints

Queries the cluster endpoints of a PolarDB cluster.

DeleteDBClusterEndpoint

Release a custom cluster endpoint of a PolarDB cluster.