All Products
Search
Document Center

Database Autonomy Service:GetRedisAllSession

Last Updated:Mar 13, 2026

Queries the current session on an ApsaraDB for Redis instance.

Operation description

  • This operation is applicable only to ApsaraDB for Redis instances.

  • If you use an SDK to call operations of Database Autonomy Service (DAS), you must set the region ID to cn-shanghai.

Note

This operation cannot be used to query sessions generated in direct connection mode on ApsaraDB for Redis cluster instances.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

hdm:GetRedisAllSession

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ConsoleContext

string

No

The reserved parameter.

None

InstanceId

string

Yes

The database instance ID.

r-2zemyfd1sh1u2i****

Response elements

Element

Type

Description

Example

object

Code

integer

The HTTP status code returned.

200

Message

string

The returned message.

Note

If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned.

Successful

Data

object

The session data.

Timestamp

integer

The time when the instance sessions were returned. The value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1660100753556

Total

integer

The total number of sessions.

2

Sessions

array<object>

The information about the sessions.

object

Sub

integer

The number of subscribed channels.

0

Psub

integer

The number of subscriptions that match the pattern.

0

Idle

integer

The duration during which the session is in the idle state. Unit: seconds.

8

Flags

string

The client flag. Valid values:

  • A: The connection needs to be closed at the earliest opportunity.

  • b: The client is waiting for blocked events.

  • c: The connection is closed after all replies are written.

  • d: The monitored keys have been modified, and the EXEC command is about to fail.

  • i: The client is waiting for VM I/O operations. This value is no longer used.

  • M: The client is the primary node.

  • N: No special flags are configured.

  • O: The client is in monitor mode.

  • r: The client is a cluster node in read-only mode.

  • S: The client is a replica node in normal mode.

  • u: The client is not blocked.

  • U: The client is connected by using UNIX domain sockets.

  • x: The client is executing a transaction.

N

Oll

integer

The number of objects contained in the output list.

0

QbufFree

integer

The remaining size of the input buffer. Unit: bytes.

0

Multi

integer

The number of commands in MULTI or EXEC.

-1

Omem

integer

The size of the output buffer. Unit: bytes.

0

Qbuf

integer

The size of the input buffer. Unit: bytes.

0

Name

string

The name of the client.

test

Obl

integer

The size of the fixed output buffer. Unit: bytes.

0

Client

string

The IP address of the client.

172.16.XX.XX

Cmd

string

The command that was last run.

PING

Id

integer

The client ID.

9080586

Addr

string

The IP address and port number of the client.

172.16.XX.XX:53458

NodeId

string

The node ID.

r-2zemyfd1sh1u2i****-proxy-14#1679****

Age

string

The connection duration of the session. Unit: seconds.

12

Db

integer

The ID of the database that the client is using.

0

Events

string

The file descriptor event. Valid values:

  • r: Client sockets are readable in the event loop.

  • w: Client sockets are writable in the event loop.

r

Fd

integer

The file descriptor that is used by sockets.

73

ClientDesc

string

The alias of the client.

prod ip

SourceStats

array<object>

The statistics on the access source.

object

Key

string

The access source.

172.16.XX.XX

Count

string

The total number of sessions from the access source.

1

Ids

array

The client IDs.

integer

The client ID.

9080586

RequestId

string

The request ID.

40C6E9AF-6C23-5614-AA83-34344CC6****

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Examples

Success response

JSON format

{
  "Code": 200,
  "Message": "Successful",
  "Data": {
    "Timestamp": 1660100753556,
    "Total": 2,
    "Sessions": [
      {
        "Sub": 0,
        "Psub": 0,
        "Idle": 8,
        "Flags": "N",
        "Oll": 0,
        "QbufFree": 0,
        "Multi": -1,
        "Omem": 0,
        "Qbuf": 0,
        "Name": "test",
        "Obl": 0,
        "Client": "172.16.XX.XX",
        "Cmd": "PING",
        "Id": 9080586,
        "Addr": "172.16.XX.XX:53458",
        "NodeId": "r-2zemyfd1sh1u2i****-proxy-14#1679****",
        "Age": "12",
        "Db": 0,
        "Events": "r",
        "Fd": 73,
        "ClientDesc": "prod ip"
      }
    ],
    "SourceStats": [
      {
        "Key": "172.16.XX.XX",
        "Count": "1",
        "Ids": [
          9080586
        ]
      }
    ]
  },
  "RequestId": "40C6E9AF-6C23-5614-AA83-34344CC6****",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.