All Products
Search
Document Center

ApsaraDB RDS:AllocateReadWriteSplittingConnection

Last Updated:May 22, 2024

Applies for a read-only routing endpoint for an instance.

Operation description

Supported database engines

  • MySQL
  • SQL Server

Feature description

If read-only instances are attached to a primary ApsaraDB RDS for SQL Server instance, you can call this operation to apply for a unified read-only routing endpoint for the primary instance. After you apply for a read-only routing endpoint for a primary instance, the existing endpoints of the primary instance and its read-only instances remain valid. In addition, you can still apply for internal and public endpoints.

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 instance is in the Running state.

  • Read-only instances are attached to the primary instance.

  • The instance does not have an ongoing Data Transmission Service (DTS) migration task.

  • The instance runs one of the following database versions and RDS editions:

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

Debugging

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

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
rds:AllocateReadWriteSplittingConnectionWRITE
  • DBInstance
    acs:rds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
  • rds:ResourceTag
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

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

rm-uf6wjk5xxxxxxx
ConnectionStringPrefixstringNo

The prefix of the read-only routing 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.
rr-m5exxxxx-rw.mysql.rds.aliyuncs.com
PortstringNo

The port that is associated with the read-only routing endpoint. Valid values: 1000 to 5999. Default value: 1433.

1433
MaxDelayTimestringNo

The threshold of the latency that is allowed on the read-only instances. Valid values: 0 to 7200. Default value: 30. Unit: seconds.

Note If the latency on a read-only instance exceeds the specified threshold, ApsaraDB RDS does not forward read requests to the read-only instance.
30
NetTypestringNo

The network type of the read-only routing endpoint. Valid values:

  • Internet
  • Intranet
Note The default value is Intranet. Make sure that the network type of the read-only routing endpoint is the same as that of the primary instance.
Intranet
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.
Standard
WeightstringNo

The read weights of the primary instance and its read-only instances. The read weight is increased in increments of 100. The maximum value is 10000.

  • 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":"<Primary instance ID>","weight":<Weight>,"role":"master"},{"instanceName":"<Primary instance ID>","weight":<Weight>,"role":"slave"},{"instanceName":"<Read-only instance ID>","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 request ID.

4C467B38-3910-447D-87BC-AC049166F216

Examples

Sample success responses

JSONformat

{
  "RequestId": "4C467B38-3910-447D-87BC-AC049166F216"
}

Error codes

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

Change history

Change timeSummary of changesOperation
2022-06-23API Description Updatesee changesets
Change itemChange content
API DescriptionAPI Description Update.