All Products
Search
Document Center

ApsaraDB RDS:ModifyReadWriteSplittingConnection

Last Updated:Jul 05, 2024

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

Operation description

Supported database engines

  • MySQL
  • SQL Server

Prerequisites

Before you call this operation, make sure that the following requirements are met:

  • The shared proxy feature is enabled for your ApsaraDB RDS for MySQL instance.

  • The read/write splitting feature is enabled for your ApsaraDB RDS for MySQL instance.

  • The instance must run one of the following database engine versions and RDS editions:

    • MySQL 5.7 on RDS High-availability Edition with local disks
    • MySQL 5.6
    • SQL Server on RDS Cluster Edition

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

The ID of the primary instance. You can call the DescribeDBInstances operation to query the instance ID.

rm-uf6wjk5xxxxxxx
ConnectionStringPrefixstringNo

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.
rm-m5xxxxxxxxrw.mysql.rds.aliyuncs.com
PortstringNo

The port that is associated with the read/write splitting endpoint.

3306
MaxDelayTimestringNo

The latency threshold that is allowed by 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 default value of this parameter is retained.

Note
  • If the primary instance runs SQL Server 2017 on RDS Cluster Edition, the MaxDelayTime parameter is not supported.
  • You must specify at least one of MaxDelayTime and DistributionType.
  • 12
    DistributionTypestringNo

    The method that is used to assign read weights. Valid values:

    • Standard: The system automatically assigns read weights to the primary and read-only instances based on the specifications of these instances.
    • Custom: You must manually assign a read weight to each instance.
    Note You must specify at least one of MaxDelayTime and DistributionType.
    Standard
    WeightstringNo

    The read weights of the primary instance and its read-only instances. A read weight must be a multiple of 100 and cannot exceed 10,000.

    • For ApsaraDB RDS instances, the value of this parameter is in the following format: {"<ID of the read-only instance >":<Weight>,"master":<Weight>,"slave":<Weight>}.
    • For ApsaraDB MyBase instances, the value of this parameter is in the following format: [{"instanceName":"<ID of the primary instance>","weight":<Weight>,"role":"master"},{"instanceName":"<ID of the primary instance>","weight":<Weight>,"role":"slave"},{"instanceName":"<ID of the read-only instance>","weight":<Weight>,"role":"master"}]
    Note
    • This parameter must be specified when DistributionType is set to Custom.

    • If DistributionType is set to Standard, this parameter is invalid.

    {"rm-bp1**********":800,"master":400,"slave":400}

    Response parameters

    ParameterTypeDescriptionExample
    object

    The response parameters.

    RequestIdstring

    The ID of the request.

    5A77D650-27A1-4E08-AD9E-59008EDB6927

    Examples

    Sample success responses

    JSONformat

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

    Error codes

    HTTP status codeError codeError messageDescription
    400ReadUniformNetTypeNotExistsThe specified uniform read only network type does not exist.The operation failed. The unified network type that you specify for the read-only RDS instances cannot be found.
    400ReadDBInstance.NotFoundThe Current DB Instance has not read-only instance.The database instance does not have any read-only instance.
    403ReadDBInstance.NotFoundThe current database instance does not contain any read only instance.The current database instance does not have a read-only instance.

    For a list of error codes, visit the Service error codes.