Creates a cache analysis task.

Before you call this operation, make sure that the following conditions are met:

  • This operation is applicable only to ApsaraDB for Redis Community Edition and ApsaraDB for Redis Enhanced Edition (Tair).
  • When you use an Alibaba Cloud SDK, make sure that the aliyun-sdk-core version is later than V4.3.3. We recommend that you use the latest version.
  • The SDK version for Database Autonomy Service (DAS) must be V1.0.3 or later.
  • When you call the SDK to call the DAS service, you must specify the region as cn-shanghai.

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 of the instance. This parameter can be used to query the monitoring information about the specified node.

Note If you specify the BackupSetId parameter, the system ignores the NodeId parameter. To query the node ID, you can call the DescribeLogicInstanceTopology operation.
BackupSetId String No 12345

The ID of the backup file. To query this value, you can call the DescribeBackups operation.

Note
  • This parameter is required if the Redis instance is a cluster instance or a read/write splitting instance. If you need to specify multiple backup file IDs, separate them with commas (,), such as 12345,67890.
  • If the Redis instance is a standard instance and you do not specify this parameter, the system automatically performs a backup and then performs cache analysis on the backup file.

Response parameters

Parameter Type Example Description
Code String 200

The returned status code.

Data Struct

The list of detailed information.

BigKeys Array of KeyInfo

The details of the big keys.

KeyInfo
Bytes Long 12345

The number of bytes that are occupied by the keys.

Count Long 127

The number of elements in the keys.

Db Integer 0

The name of the database.

Encoding String hashtable

The data type of the keys.

ExpirationTimeMillis Long 1596256542547

The time when the keys expire. Unit: millisecond. The value 0 indicates that the keys do not expire.

Key String task_x****

The name of the key.

NodeId String r-x****-db-0

The data node ID of the instance.

Type String hash

The type of the Redis data structure.

InstanceId String r-bp18ff4a195d****

The ID of the instance.

JobId String sf79-sd99-sa37-****

The ID of the cache analysis task.

Note This parameter can be used to query cache analysis tasks. When you call this operation, it takes some time to create a cache analysis task. As a result, the analysis results are not immediately returned. To obtain the analysis results, you must use this parameter together with the DescribeCacheAnalysisJob API operation.
Message String Successful

The returned message for the request.

Note If the request is successful, Successful is returned. If the request fails, an exception message that contains an error code is returned.
NodeId String r-x****-db-0

The data node ID of the instance.

TaskState String BACKUP

The status of the cache analysis task. Valid values:

  • BACKUP: The data is being backed up.
  • ANALYZING: The task is in the analysis phase.
  • FINISHED: The analysis is complete.
  • FAILED: An error occurred.
Message String Successful

The returned message for the request.

Note If the request is successful, Successful is returned. If the request fails, an exception message that contains an error code is returned.
RequestId String B6D17591-B48B-4D31-9CD6-9B9796B2****

The ID of the request.

Success String true

Indicates whether the request was successful.

  • true: The request was successful.
  • false: The request failed.

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=CreateCacheAnalysisJob
&InstanceId=r-bp18ff4a195d****
&NodeId=r-x****-db-0
&<Common request parameters>

Sample success responses

XML format

<CreateCacheAnalysisJobReponse>
  <RequestId> B6D17591-B48B-4D31-9CD6-9B9796B2270A</RequestId>
  <Message>Successful</Message>
  <Data>
        <BigKeys>
              <KeyInfo>
                    <Bytes>12345</Bytes>
                    <Type>hash</Type>
                    <NodeId>r-xxxxx-db-0</NodeId>
                    <ExpirationTimeMillis>1596256542547</ExpirationTimeMillis>
                    <Encoding>hashtable</Encoding>
                    <Count>127</Count>
                    <Key>task_xxxxx</Key>
                    <Db>0</Db>
              </KeyInfo>
        </BigKeys>
        <Message>Successful</Message>
        <InstanceId>r-bp18ff4a195dxxxx</InstanceId>
        <NodeId>r-xxxxx-db-0</NodeId>
        <TaskState>BACKUP</TaskState>
        <JobId>xxxx-xxxx-xxxx-xxxx</JobId>
  </Data>
  <Code>200</Code>
  <Success>true</Success>
</CreateCacheAnalysisJobReponse>

JSON format

{"RequestId":" B6D17591-B48B-4D31-9CD6-9B9796B2270A",
"Message":"Successful",
"Data":{
    "BigKeys":{
        "KeyInfo":[{
            "Bytes":"12345",
            "Type":"hash",
            "NodeId":"r-xxxxx-db-0",
            "ExpirationTimeMillis":"1596256542547",
            "Encoding":"hashtable",
            "Count":"127",
            "Key":"task_xxxxx",
            "Db":"0"}]},
            "Message":"Successful",
            "InstanceId":"r-bp18ff4a195dxxxx",
            "NodeId":"r-xxxxx-db-0",
            "TaskState":"BACKUP",
            "JobId":"xxxx-xxxx-xxxx-xxxx"},
            "Code":"200",
            "Success":"true"}

Error codes

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