Modifies the latency threshold on the read/write splitting link and the read weights of a primary ApsaraDB for RDS instance and its read-only instances.

Before you call this operation, make sure that the primary instance meets the following requirements:

  • The primary instance is using a shared proxy.
  • The primary instance is in the Running state.
  • The primary instance does not have an ongoing migration task.
  • The primary instance is running one of the following database engine versions and RDS editions:
    • MySQL 5.7 in the High-availability Edition (with local SSDs)
    • MySQL 5.6
    • SQL Server 2017 in the Cluster Edition

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyReadWriteSplittingConnection

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the primary instance.

ConnectionStringPrefix String No rm-m5xxxxxxxx.mysql.rds.aliyuncs.com

The prefix of the read/write splitting endpoint. The prefix must be unique. It can be up to 30 characters in length and can contain lowercase letters and hyphens (-). It must start with a lowercase letter.

Note The default prefix consists of the name of the primary instance followed by the letters rw.
Port String No 3306

The port associated with the read/write splitting endpoint.

MaxDelayTime String No 12

The latency threshold on the read/write splitting link. Unit: seconds. If the latency on a read-only instance exceeds the specified threshold, the system no longer routes read requests to the read-only instance. If you do not specify this parameter, the original value is retained.

Note
  • If the primary instance is running SQL Server 2017 and the Cluster Edition, the MaxDelayTime parameter is not supported.
  • You must specify either the MaxDelayTime or DistributionType parameter.
DistributionType String No Standard

The method to assign read weights. Valid values:

  • Standard: The system automatically assigns a read weight to each instance based on the instance specifications.
  • Custom: You must manually assign a read weight to each instance.
Note You must specify either the MaxDelayTime or DistributionType parameter.
Weight String No {"Instanceid1":"100","Instanceid2":"200"}

The read weights of the primary and read-only instances. A read weight must be a multiple of 100 and cannot exceed 10000. Format: {"Instanceid1":"Weight","Instanceid2":"Weight"...}.

Note
  • This parameter must be specified when you set the DistributionType parameter to Custom.
  • This parameter must be specified when you set the DisrtibutionType parameter to Standard.

Response parameters

Parameter Type Example Description
RequestId String 5A77D650-27A1-4E08-AD9E-59008EDB6927

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=ModifyReadWriteSplittingConnection
&DistributionType=Standard
&DBInstanceId=rm-uf6wjk5xxxxxxx
&<Common request parameters>

Sample success responses

XML format

<ModifyReadWriteSplittingConnectionResponse>
      <RequestID>5A77D650-27A1-4E08-AD9E-59008EDB6927</RequestID>
</ModifyReadWriteSplittingConnectionResponse>

JSON format

{
    "RequestID":"5A77D650-27A1-4E08-AD9E-59008EDB6927"
  }

Error codes

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