You can call the ModifyDBProxyEndpoint operation to modify the proxy terminal settings of an instance.

Before you call the ModifyDBProxyEndpoint operation, make sure that the ModifyDBProxy operation is called to enable the database proxy feature for the instance.

  • The dedicated proxy feature of ApsaraDB RDS for MySQL provides capabilities such as read/write splitting and short-lived connection optimization. For more information, see What are database proxies?
  • The database proxy feature of ApsaraDB RDS for PostgreSQL supports read/write splitting. For more information, see What are database proxies?

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 ModifyDBProxyEndpoint

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

DBInstanceId String Yes rm-bp145737x5bi6****

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

DBProxyEndpointId String Yes gos787jog2wk0y****

The ID of the proxy endpoint. You can call the DescribeDBProxyEndpoint operation to query the ID of the proxy endpoint.

Note
  • If the instance runs MySQL and you set the DbEndpointOperator parameter to Delete or Modify, you must specify the DBProxyEndpointId parameter.
  • If the instance runs PostgreSQL and you set the DbEndpointOperator parameter to Delete, Modify, or Create, you must specify the DBProxyEndpointId parameter.
ConfigDBProxyFeatures String No ReadWriteSpliting:1;ConnectionPersist:0

The features that you want to enable for the proxy endpoint. If you specify more than one feature, separate the features with semicolons (;). Format: Feature 1:Status;Feature 2:Status;.... Do not add a semicolon (;) at the end of the last value.

Valid feature values:

  • ReadWriteSpliting: read/write splitting
  • ConnectionPersist: connection pooling
  • TransactionReadSqlRouteOptimizeStatus: transaction splitting

Valid status values:

  • 1: enabled
  • 0: disabled
Note If the instance runs PostgreSQL, you can enable only the read/write splitting feature, which is specified by ReadWriteSpliting.
RegionId String No cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

ReadOnlyInstanceMaxDelayTime String No 30

The maximum latency threshold that is allowed for read/write splitting. If the latency on a read-only instance exceeds the threshold that you specified, ApsaraDB RDS no longer forwards read requests to the read-only instance. If you do not specify this parameter, the original value of this parameter is retained. Unit: seconds. Valid values: 30 to 3600. Default value: 30.

Note You must specify this parameter only when the read/write splitting feature is enabled.
ReadOnlyInstanceDistributionType String No Standard

The policy that is used to allocate read weights. Valid values:

  • Standard: ApsaraDB RDS automatically allocates read weights to the instance and its read-only instances based on the specifications of the instances.
  • Custom: You must manually allocate read weights to the instance and its read-only instances.
Note You must specify this parameter only when the read/write splitting feature is enabled.

For more information about the permission allocation policy, see Modify the latency threshold and read weights of ApsaraDB RDS for MySQL instances and Enable and configure the database proxy feature for an ApsaraDB RDS for PostgreSQL instance.

ReadOnlyInstanceWeight String No {"rm-uf6wjk5xxxx":"500","rr-tfhfgk5xxx":"200"...}

The read weights of the instance and its read-only instances. A read weight must be a multiple of 100 and cannot exceed 10000. Formats:

  • Standard instance: {"ID of the primary instance":"Weight","ID of the read-only instance":"Weight"...}

    Example: {"rm-uf6wjk5xxxx":"500","rr-tfhfgk5xxx":"200"...}

  • Cluster instance: {"ID of the read-only instance ID":"Weight","DBClusterNode":{"ID of the primary node":"Weight","ID of the secondary node ID":"Weight","ID of the secondary node ID":"Weight"...}}

    Example: {"rr-tfhfgk5xxx":"200","DBClusterNode":{"rn-2z****":"0","rn-2z****":"400","rn-2z****":"400"...}}
    Note The DBClusterNode parameter is required if the instance runs RDS Cluster Edition. The DBClusterNode parameter includes information about IDs and weights of the primary and secondary nodes.
DbEndpointOperator String No Modify

The type of the operation that you want to perform. Valid values:

  • Modify: Modify a proxy terminal. This is the default value.
  • Create: Create a proxy terminal.
  • Delete: Delete a proxy terminal.
DbEndpointAliases String No test-proxy

The description of the proxy terminal.

DbEndpointType String No RWSplit

The type of the proxy terminal. This is a reserved parameter. You do not need to specify this parameter.

DbEndpointReadWriteMode String No ReadWrite

The read and write attributes of the proxy terminal. Valid values:

  • ReadWrite: The proxy terminal connects to the primary instance and can receive both read and write requests.
  • ReadOnly: The proxy terminal does not connect to the primary instance and can receive only read requests. This is the default value.
Note
  • If you set the DbEndpointOperator parameter to Create, you must also specify the DbEndpointReadWriteMode parameter.
  • If the instance runs MySQL and you change the value of this parameter from ReadWrite to ReadOnly, the transaction splitting feature is disabled.
DBProxyEngineType String No normal

An internal parameter. You do not need to specify this parameter.

Response parameters

Parameter Type Example Description
RequestId String 6B50D92C-1960-4D4F-A290-AFADD6B1A5C8

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ModifyDBProxyEndpoint
&DBInstanceId=rm-bp145737x5bi6****
&DBProxyEndpointId=gos787jog2wk0y****
&ConfigDBProxyFeatures=ReadWriteSpliting:1;ConnectionPersist:1;
&ReadOnlyInstanceMaxDelayTime=30
&ReadOnlyInstanceDistributionType=Standard
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyDBProxyEndpointResponse>
  <RequestId>6B50D92C-1960-4D4F-A290-AFADD6B1A5C8</RequestId>
</ModifyDBProxyEndpointResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "6B50D92C-1960-4D4F-A290-AFADD6B1A5C8"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidVpcInstanceId The specified VPC instance ID is invalid. The error message returned because the VPC ID that you specified is invalid.
400 InvalidEndPoint.Format The specified EndPoint is not valid. The error message returned because the DBProxyEndpointId parameter is empty or the proxy endpoint specified by the DBProxyEndpointId parameter cannot be found.
400 InvalidEndpointType.Format The specified EndpointType is invalid. The error message returned because the value of the EndpointType parameter is invalid.
400 IncorrectDBInstanceNetType The current database instance network type does not support the operation. The error message returned because the network type of the instance does not support this operation.
400 EndpointNum.Error The number of endpoint is invalid. The error message returned because the number of proxy terminals that you have configured does not meet the requirements.
400 EndpointTypeOperation.NotSupport The endpoint type does not support the operation. The error message returned because the specified proxy terminal type does not support this operation.
400 InvalidDBInstanceName Specified parameter DBInstanceName is not valid. The error message returned because the value of the DBInstanceName parameter is invalid. Check whether the value is null or an empty string.
400 ClusterEndpoint.StatusNotValid The cluster endpoint status is invalid. The error message returned because the status of the proxy endpoint is invalid.
403 MaxScaleLevel.NotSupport The current maxscale ins_num does not support this operation. The error message returned because the database proxy specifications do not support this operation.
403 ReadDBInstance.NotFound The current database instance does not contain any read only instance. The error message returned because no read-only instances are attached to the instance.
403 IncorrectKindCode The current KindCode of the custins does not support the operation. The error message returned because the configuration of the instance does not support this operation. Check the configuration of the instance.
403 IncorrectDBInstanceState The current database instance state does not support the operation. The error message returned because the status of the instance does not support this operation. Check whether the instance is in the Running state.
404 EndpointConfig.Invalid Please check the endpoint config parameter. The error message returned because the proxy terminal settings are invalid. Check the values of the related parameters.
404 Readins.NotFound The current instance does not contain any read only instance. The operation is not supported. The error message returned because no read-only instances are attached to the instance.
404 Endpoint.NotFound Specified endpoint is not found. The error message returned because the port that is used to connect to the proxy endpoint cannot be found.
404 EndpointType.NotFound The specified endpoint type is not found. The error message returned because the proxy terminal type that you specified is unknown to the system.
404 InvalidReadDBInstance.NotFound The specified read only database instance does not exist. The error message returned because no read-only instances are attached to the instance or the settings of some request parameters are incorrect.
404 InvalidParam The specified Weight is invalid. The error message returned because the read weights that you specified are invalid.

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