调用UpdateAutoThrottleRulesAsync接口,采用异步方式,批量设置指定数据库实例的自动SQL限流配置参数。
说明 异步调用后不会立即返回完整结果,当返回数据中isFinish取值为false时,请等待1s后重新发起调用,直到isFinish取值为true时,返回完整结果。
使用该接口需满足以下前提条件:
- 在使用SDK调用DAS服务时,需要将地域指定为cn-shanghai。
- 目标数据库实例已开启自治服务,详情请参见自治中心。
- 目标数据库实例为:
- RDS MySQL 5.6、5.7、 8.0高可用版、三节点企业版。
- PolarDB MySQL 5.6集群版、5.7集群版、 8.0集群版、8.0高压缩引擎(X-Engine)。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | UpdateAutoThrottleRulesAsync |
系统规定参数。取值:UpdateAutoThrottleRulesAsync。 |
ConsoleContext | String | 否 | None |
备用参数。 |
InstanceIds | String | 是 | ['rm-2ze8g2am97624****','rm-2ze9xrhze0709****'] |
数据库实例ID。 说明 数据格式为JSONArray,例如
['实例ID1','实例ID2'] ,实例ID间用英文逗号(,)分隔。
|
CpuUsage | double | 否 | 70 |
CPU利用率阈值,取值范围:70%~100%。 |
CpuSessionRelation | String | 是 | OR |
CPU利用率阈值和活跃会话数阈值的逻辑关系。
|
ActiveSessions | Long | 否 | 16 |
活跃会话数阈值。
|
AbnormalDuration | double | 否 | 2 |
触发自动SQL限流的异常的持续时间阈值,取值范围:大于等于2的正整数,单位:分钟。 |
MaxThrottleTime | double | 否 | 10 |
最大限流时长,取值为正在数,单位:分钟。 |
AllowThrottleStartTime | String | 是 | 00:00Z |
可限流时间段的开始时间(UTC时间)。 |
AllowThrottleEndTime | String | 是 | 23:59Z |
可限流时间段的结束时间(UTC时间)。 |
AutoKillSession | Boolean | 否 | true |
是否同时KILL执行中的异常SQL: 说明 异常SQL:与需要限流的SQL模板相同。
|
ResultId | String | 否 | async__507044db6c4eadfa2dab9b084e80**** |
异步请求的ID。 说明 对于相同调用请求,首次调用时不输入,后续调用时使用首次调用返回数据中的该字段。
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Code | Long | 200 |
返回的状态码。 |
Message | String | Successful |
请求返回消息。 说明 请求成功时该参数返回Successful,请求失败时会返回请求异常信息(如错误码等)。
|
Data | Object |
返回的数据。 |
|
Fail | Boolean | false |
请求是否失败:
|
ConfigResponse | Object |
批量设置的返回数据。 说明 异步请求完成时(即isFinish取值为true时)才会返回该数据。
|
|
TotalInstanceCount | Long | 2 |
总数据库实例数量。 |
ConfigSuccessInstanceCount | Long | 1 |
设置成功的数据库实例数量。 |
ConfigFailInstanceCount | Long | 1 |
设置失败的数据库实例数量。 |
ConfigSuccessInstanceList | Array of configSuccessInstanceList |
设置成功的数据库实例列表。 |
|
ConfigSuccess | Boolean | true |
设置是否成功:
|
InstanceId | String | rm-2ze8g2am97624**** |
数据库实例ID。 |
ConfigFailInstanceList | Array of configFailInstanceList |
设置失败的数据库实例列表。 |
|
ConfigSuccess | Boolean | false |
设置是否成功:
|
InstanceId | String | rm-2ze9xrhze0709**** |
数据库实例ID。 |
ErrorMessage | String | instance das autonomy service is off or can not find instance |
错误信息。 |
ResultId | String | async__665ee69612f1627c7fd9f3c85075**** |
异步请求ID。 |
IsFinish | Boolean | true |
异步请求是否执行完成:
|
State | String | SUCCESS |
异步请求的执行状态:
|
Complete | Boolean | true |
异步请求是否执行完成:
|
Timestamp | Long | 1645668213000 |
执行时间,格式为Unix时间戳,单位为毫秒。 |
RequestId | String | B6D17591-B48B-4D31-9CD6-9B9796B2**** |
请求ID。 |
Success | Boolean | true |
请求是否执行成功:
|
示例
请求示例
http(s)://das.cn-shanghai.aliyuncs.com/?Action=UpdateAutoThrottleRulesAsync
&InstanceIds=['rm-2ze8g2am97624****','rm-2ze9xrhze0709****']
&CpuUsage=70.0
&CpuSessionRelation=OR
&ActiveSessions=16
&AbnormalDuration=2.0
&MaxThrottleTime=10.0
&AllowThrottleStartTime=00:00Z
&AllowThrottleEndTime=23:59Z
&AutoKillSession=true
&ResultId=async__507044db6c4eadfa2dab9b084e80****
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<UpdateAutoThrottleRulesAsyncResponse>
<Code>200</Code>
<Message>Successful</Message>
<Data>
<Fail>false</Fail>
<ConfigResponse>
<TotalInstanceCount>2</TotalInstanceCount>
<ConfigSuccessInstanceCount>1</ConfigSuccessInstanceCount>
<ConfigFailInstanceCount>1</ConfigFailInstanceCount>
<ConfigSuccessInstanceList>
<ConfigSuccess>true</ConfigSuccess>
<InstanceId>rm-2ze8g2am97624****</InstanceId>
</ConfigSuccessInstanceList>
<ConfigFailInstanceList>
<ConfigSuccess>false</ConfigSuccess>
<InstanceId>rm-2ze9xrhze0709****</InstanceId>
<ErrorMessage>instance das autonomy service is off or can not find instance</ErrorMessage>
</ConfigFailInstanceList>
</ConfigResponse>
<ResultId>async__665ee69612f1627c7fd9f3c85075****</ResultId>
<IsFinish>true</IsFinish>
<State>SUCCESS</State>
<Complete>true</Complete>
<Timestamp>1645668213000</Timestamp>
</Data>
<RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
<Success>true</Success>
</UpdateAutoThrottleRulesAsyncResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"Code" : 200,
"Message" : "Successful",
"Data" : {
"Fail" : false,
"ConfigResponse" : {
"TotalInstanceCount" : 2,
"ConfigSuccessInstanceCount" : 1,
"ConfigFailInstanceCount" : 1,
"ConfigSuccessInstanceList" : [ {
"ConfigSuccess" : true,
"InstanceId" : "rm-2ze8g2am97624****"
} ],
"ConfigFailInstanceList" : [ {
"ConfigSuccess" : false,
"InstanceId" : "rm-2ze9xrhze0709****",
"ErrorMessage" : "instance das autonomy service is off or can not find instance"
} ]
},
"ResultId" : "async__665ee69612f1627c7fd9f3c85075****",
"IsFinish" : true,
"State" : "SUCCESS",
"Complete" : true,
"Timestamp" : 1645668213000
},
"RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success" : true
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidParams | The request parameters are invalid. | 请求参数错误 |
访问错误中心查看更多错误码。