Creates a resource control rule for a specified PolarDB for MySQL cluster. You can set MaxCpu to specify the maximum CPU quota percentage that the rule can use, or set CpuCount to specify the maximum number of CPU cores that the rule can use. You must specify one and only one of MaxCpu and CpuCount when creating a rule.
Operation description
Resource Control limits the CPU resources that can be used by a specified user, database, query, or connection in a PolarDB for MySQL cluster. This release supports creating, modifying, deleting, binding, and unbinding resource control rules. Querying Resource Control CPU usage is not supported.
Before you begin
This feature applies only to PolarDB for MySQL Cluster Edition clusters that support Resource Control. PolarDB for MySQL Standard Edition is not supported.
The cluster kernel parameter loose_enable_resource_control must be set to ON.
MaxCpu and CpuCount are two mutually exclusive CPU quota modes.
The maximum value of CpuCount is determined by the kernel parameter resource_control_cpu_count_limit of the target cluster.
Try it now
Test
RAM authorization
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
No |
The region ID of the PolarDB cluster. Note
You can call the DescribeRegions operation to query available regions. |
cn-beijing |
| DBClusterId |
string |
Yes |
The PolarDB cluster ID. |
pc-************** |
| ResourceControlName |
string |
Yes |
The name of the resource control rule. The name must be 1 to 63 ASCII bytes in length, start with a letter, and can contain only letters, digits, and underscores. |
test_rc |
| MaxCpu |
integer |
No |
The maximum CPU quota percentage that the resource control rule can use. Valid values: 1 to 100. You must specify one and only one of this parameter and CpuCount. |
20 |
| CpuCount |
integer |
No |
The maximum number of CPU cores that the resource control rule can use. The minimum value is 1. The maximum value is determined by the cluster kernel parameter resource_control_cpu_count_limit. You must specify one and only one of this parameter and MaxCpu. |
4 |
You must specify one and only one of MaxCpu and CpuCount when creating a rule.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
Id of the request |
C61892A4-0850-4516-9E26-44D96C1782DE |
Examples
Success response
JSON format
{
"RequestId": "C61892A4-0850-4516-9E26-44D96C1782DE"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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. | The specified DBClusterId parameter does not exist in the current record. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.