Updated on 2025-07-02 GMT+08:00

Obtaining Sessions of a Node

Function

This API is used to obtain all sessions of a node.

Constraints

This API supports GeminiDB Redis instances.

URI

GET https://{Endpoint}/v3/{project_id}/redis/nodes/{node_id}/sessions

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Explanation:

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Constraints:

N/A

Values:

N/A

Default value:

N/A

node_id

Yes

String

Explanation:

Node ID.

Constraints:

N/A

Values:

N/A

Default value:

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Explanation:

Index offset

Constraints:

N/A

Values:

Greater than or equal to 0

Default value:

The default value is 0, indicating that the query starts from the latest instance node.

limit

No

Integer

Explanation:

Number of pages in a pagination query

Constraints:

A maximum of 100 pages are supported.

Values:

1 to 100

Default value:

If this parameter is not transferred, 50 sessions are displayed on each page by default.

addr_prefix

No

String

Explanation:

Matching character string of a user address prefix Constraints:

A complete address consists of an IP address and a port number.

Values:

N/A

Default value:

If this parameter is not transferred, all address prefixes are queried by default.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Explanation:

User token.

Constraints:

N/A

Values:

N/A

Default value:

N/A

X-Language

No

String

Explanation:

Language

Constraints:

N/A

Values:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

sessions

Array of objects

Explanation:

Instance sessions. For details, see Table 5.

Values:

N/A

total_count

Integer

Explanation:

Total sessions that meet search criteria.

Values:

N/A

Table 5 InstanceSession

Parameter

Type

Description

addr

String

Explanation:

IP address and port number of the client.

Values:

N/A

id

String

Explanation:

Client ID.

Values:

N/A

name

String

Explanation:

Client name, which is specified by running CLIENT SETNAME.

Values:

N/A

cmd

String

Explanation:

Last executed command.

Values:

N/A

age

String

Explanation:

Setup duration of the client connection, in seconds.

Values:

N/A

idle

String

Explanation:

Idle duration of the client connection, in seconds.

Values:

N/A

db

String

Explanation:

ID of the currently accessed database.

Values:

N/A

fd

String

Explanation:

File descriptor for sockets.

Values:

N/A

sub

String

Explanation:

Number of subscribed channels (Pub/Sub).

Values:

N/A

psub

String

Explanation:

Number of subscribed channels (Pub/Sub) in batches.

Values:

N/A

multi

String

Explanation:

Number of commands contained in a MULTI or EXEC transaction.

Values:

N/A

Example Requests

GET https://{Endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/redis/nodes/784b3fb7bac14bc490659950dd4f022fno12/sessions?offset=0&limit=20&addr_prefix=192.0.0.1:80

Example Responses

Status code: 200

Success

{ 
  "total_count" : 100, 
  "sessions" : [ { 
    "addr" : "127.0.0.1:8080", 
    "id" : "254487", 
    "name" : "cli", 
    "cmd" : "get", 
    "age" : "8888581", 
    "idle" : "8888581", 
    "db" : "0", 
    "fd" : "1311", 
    "sub" : "0", 
    "psub" : "0", 
    "multi" : "-1" 
  } ] 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.