Creates a cache analysis task.
Before you call this operation, take note of the following items:
- If you use an Alibaba Cloud SDK or a Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.
- If you use an SDK to call DAS, you must set the region ID to cn-shanghai.
- This operation is applicable only to ApsaraDB for Redis Community Edition instances and the performance-enhanced instances of ApsaraDB for Redis Enhanced Edition (Tair).
Request parameters
Parameter | Type | Required | Example | Description |
Action | String | Yes | CreateCacheAnalysisJob | The operation that you want to perform. Set the value to CreateCacheAnalysisJob. |
InstanceId | String | Yes | r-bp18ff4a195d**** | The ID of the ApsaraDB for Redis instance. |
NodeId | String | No | r-x****-db-0 | The ID of the data node on the instance. You can specify this parameter to query the monitoring information about the specified node. Note If you specify BackupSetId, the system ignores the value of NodeId. You can call the DescribeLogicInstanceTopology operation to query the node ID. |
BackupSetId | String | No | 12345 | The ID of the backup file. You can call the DescribeBackups operation to query the backup file ID.
|
Separators | String | No | & | The delimiters used to identify the prefixes of keys. You do not need to specify this parameter if one or more of the following default delimiters are used: |
Response parameters
Parameter | Type | Example | Description |
Message | String | Successful | The returned message. Note If the request was successful, Successful is returned. If the request failed, an error message that contains information such as an error code is returned. |
RequestId | String | B6D17591-B48B-4D31-9CD6-9B9796B2**** | The request ID. |
Data | Object | The details of the task. |
|
TaskState | String | BACKUP | The state of the cache analysis task. Valid values:
|
JobId | String | sf79-sd99-sa37-**** | The ID of the cache analysis task. Note This parameter can be used to query a specific cache analysis task. When you call the CreateCacheAnalysisJob operation, the system needs time to create a cache analysis task. Therefore, the analysis results cannot be immediately returned. You can specify this parameter when you call the DescribeCacheAnalysisJob operation to query the analysis results of the specified cache analysis task. |
Message | String | Successful | The returned message. Note If the request was successful, Successful is returned. If the request failed, an error message that contains information such as an error code is returned. |
BigKeys | Array of KeyInfo | The details of the large keys. The returned large keys are sorted in descending order based on the number of bytes occupied by the keys. |
|
KeyInfo | |||
Type | String | hash | The data type of the ApsaraDB for Redis instance. |
Db | Integer | 0 | The name of the database. |
ExpirationTimeMillis | Long | 1596256542547 | The expiration time of the key. Unit: millisecond. A value of 0 indicates that the key does not expire. |
Key | String | task_x**** | The name of the key. |
Encoding | String | hashtable | The data type of the key. |
Bytes | Long | 12345 | The number of bytes that are occupied by the key. |
NodeId | String | r-x****-db-0 | The ID of the data node on the instance. |
Count | Long | 127 | The number of elements in the key. |
InstanceId | String | r-bp18ff4a195d**** | The ID of the database instance. |
NodeId | String | r-x****-db-0 | The ID of the data node on the instance. |
Code | String | 200 | The response code. |
Success | String | true | Indicates whether the request was successful. Valid values:
|
Examples
Sample requests
http(s)://das.cn-shanghai.aliyuncs.com/?Action=CreateCacheAnalysisJob
&InstanceId=r-bp18ff4a195d****
&NodeId=r-x****-db-0
&BackupSetId=12345
&Separators=&
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateCacheAnalysisJobResponse>
<Message>Successful</Message>
<RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
<Data>
<TaskState>BACKUP</TaskState>
<JobId>sf79-sd99-sa37-****</JobId>
<Message>Successful</Message>
<BigKeys>
<Type>hash</Type>
<Db>0</Db>
<ExpirationTimeMillis>1596256542547</ExpirationTimeMillis>
<Key>task_x****</Key>
<Encoding>hashtable</Encoding>
<Bytes>12345</Bytes>
<NodeId>r-x****-db-0</NodeId>
<Count>127</Count>
</BigKeys>
<InstanceId>r-bp18ff4a195d****</InstanceId>
<NodeId>r-x****-db-0</NodeId>
</Data>
<Code>200</Code>
<Success>true</Success>
</CreateCacheAnalysisJobResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Message" : "Successful",
"RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Data" : {
"TaskState" : "BACKUP",
"JobId" : "sf79-sd99-sa37-****",
"Message" : "Successful",
"BigKeys" : [ {
"Type" : "hash",
"Db" : 0,
"ExpirationTimeMillis" : 1596256542547,
"Key" : "task_x****",
"Encoding" : "hashtable",
"Bytes" : 12345,
"NodeId" : "r-x****-db-0",
"Count" : 127
} ],
"InstanceId" : "r-bp18ff4a195d****",
"NodeId" : "r-x****-db-0"
},
"Code" : "200",
"Success" : "true"
}
Error codes
HTTP status code | Error code | Error message | Description |
400 | InvalidParams | The request parameters are invalid. | The request parameters are invalid. |
403 | NoPermission | You are not authorized to do this action. | You are not authorized to perform this operation. |
For a list of error codes, see Service error codes.