為指定的 PolarDB MySQL 叢集建立資源控制規則。您可以透過 MaxCpu 設定規則可使用的最大 CPU 配額百分比,或者透過 CpuCount 設定規則可使用的最大 CPU 核心數。 建立時必須且只能指定 MaxCpu 和 CpuCount 其中一個參數。
介面說明
Resource Control 用於限制 PolarDB MySQL 叢集中指定使用者、資料庫、查詢或連線可使用的 CPU 資源。本期開放建立、修改、刪除、綁定和解綁能力,不提供 Resource Control CPU 使用率查詢功能。
使用限制
僅適用於支援 Resource Control 的 PolarDB MySQL 叢集版,PolarDB MySQL 標準版不支援。
叢集核心參數 loose_enable_resource_control 必須設定為 ON。
MaxCpu 和 CpuCount 是兩種互斥的 CPU 配額模式。
CpuCount 的最大值由目標叢集核心參數 resource_control_cpu_count_limit 決定。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求文法
POST HTTP/1.1
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
否 |
PolarDB 叢集所在地域的 ID。 說明
您可以透過 DescribeRegions 介面查看可用區域。 |
cn-beijing |
| DBClusterId |
string |
是 |
PolarDB 叢集 ID。 |
pc-************** |
| ResourceControlName |
string |
是 |
資源控制規則名稱。長度為 1~63 個 ASCII 位元組,必須以英文字母開頭,僅支援英文字母、數字和底線。 |
test_rc |
| MaxCpu |
integer |
否 |
資源控制規則可使用的最大 CPU 配額百分比。取值範圍為 1~100。與 CpuCount 必須且只能指定其中一個。 |
20 |
| CpuCount |
integer |
否 |
資源控制規則可使用的最大 CPU 核心數。最小值為 1,最大值由叢集核心參數 resource_control_cpu_count_limit 決定。與 MaxCpu 必須且只能指定其中一個。 |
4 |
建立時必須且只能指定 MaxCpu 和 CpuCount 其中一個參數。
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
Schema of Response |
||
| RequestId |
string |
Id of the request |
C61892A4-0850-4516-9E26-44D96C1782DE |
樣本
正常返回樣本
JSON格式
{
"RequestId": "C61892A4-0850-4516-9E26-44D96C1782DE"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | InvalidParameters.Malformed | The specified Resource Control parameter is not valid. | |
| 400 | Database.ConnectError | Unable to connect to the database instance. | |
| 400 | Database.ExecError | The Resource Control operation could not be executed on the database instance. | |
| 403 | IncorrectDBInstanceType | Resource Control is not supported for the current DB cluster edition or kernel configuration. | |
| 403 | AuthorizationFailure | The request is not authorized to operate Resource Control. | |
| 404 | InvalidDBClusterId.NotFound | The DBClusterId provided does not exist in our records. | 目前的記錄中不存在提供的 DBClusterId。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。