You can call this operation to modify the attributes of a specified Apsara PolarDB cluster, including the read/write mode, consistency level, transaction splitting, connection pool, offload reads from primary node, and automatically associate new nodes.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required Example Description
Action String No ModifyDBClusterEndpoint

The operation that you want to perform. Set the value to ModifyDBClusterEndpoint.

DBClusterId String Yes pc-xxxxxxxxxxxxxxxxxx

The ID of the Apsara PolarDB cluster that you want to manage.

DBEndpointId String Yes pe-xxxxxxxx

The ID of the endpoint for the Apsara PolarDB cluster. Example: pe-xxxxxxxx.

Nodes String No pi-xxxxxxxxxx,pi-xxxxxxxxxx

Adds at least two PolarDB nodes that process read requests sent to this endpoint. Separate multiple nodes with commas (,).

If you do not specify this parameter, the pre-defined nodes are used.

ReadWriteMode String No ReadWrite

Read/write mode:

  • ReadWrite: automatic read/write splitting
  • ReadOnly: read only

Default value: ReadOnly.

AutoAddNewNodes String No Enable

Specifies whether to automatically associate new nodes to this endpoint. Valid values:

  • Enable
  • Disable

Default value: Disable.

EndpointConfig String No {"ConsistLevel":"1","DistributedTransaction":"on","MasterAcceptReads":"off","ConnectionPersist": "on"}

The advanced settings of the endpoint of Apsara PolarDB clusters are in JSON format, including the settings of consistency level, transaction splitting, connection pool, and offload reads from primary node.

Note Only PolarDB for MySQL supports the settings of transaction splitting, connection pool, and offload reads from primary node.

Set the consistency level in the format of {"ConsistLevel":"Consistency level"}

Valid values of consistency levels:

  • 0: eventual consistency
  • 1: session consistency (default)
  • 2: global consistency

Set transaction splitting in the format of {"DistributedTransaction":"Transaction splitting settings"}

Valid values of transaction splitting:

  • On: enable transaction splitting (default)
  • Off: disable transaction splitting

Set the offload reads from primary node feature in the format of {"MasterDoNotAcceptReads": "Offload reads from primary node"}

Valid values of offload reads from primary node:

  • On: if disabled, the master database accepts reads
  • Off: if enabled (default), the master database does not accept reads

Set the connection pool in the format of {"ConnectionPersist": "Connection pool"}

Valid values of connection pool:

  • On: enables connection pool
  • Off: disables connection pool (default)
Note
  • Only PolarDB for MySQL supports global consistency.
  • If the ReadWriteMode parameter is set to ReadOnly, the consistency level must be set to 0.
  • You can set the consistency level, transaction splitting, offload reads from primary node, and connection pool at a time. Example: {"ConsistLevel": "1","DistributedTransaction": "on","MasterDoNotAcceptReads":"1","ConnectionPersist": "on"}.
  • The setting of transaction splitting is restricted by the setting of consistency level. For example, if you set the consistency level to 0, transaction splitting cannot be enabled. If you set the consistency level to 1 or 2, transaction splitting can be enabled.
  • You can only set the connection pool for the default cluster endpoint of Apsara PolarDB clusters.

Response parameters

Parameter Type Example Description
RequestId String CD3FA5F3-FAF3-44CA-AFFF-BAF869666D6B

The ID of the request.

Example

Sample requests

http(s)://[Endpoint]/? Action=ModifyDBClusterEndpoint
&DBClusterId=pc-xxxxxxxxxxxxxxxxxx
&DBEndpointId=pe-xxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<ModifyDBClusterEndpointResponse>  
      <RequestId>CD3FA5F3-FAF3-44CA-AFFF-BAF869666D6B</RequestId>
</ModifyDBClusterEndpointResponse>

JSON format

{
    "RequestId": "CD3FA5F3-FAF3-44CA-AFFF-BAF869666D6B"
}

Error codes

For a list of error codes, visit the API Error Center.