Help Center/ GeminiDB/ API Reference/ APIs v3/ Instances/ Obtaining Sessions of a Node
Updated on 2023-11-21 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 /v3/{project_id}/redis/nodes/{node_id}/sessions

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

node_id

Yes

String

Node ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Index offset. The value must be no less than 0. If this parameter is not transferred, the index offset is 0 by default, indicating that the query starts from the latest created session to the instance node.

limit

No

Integer

Number of pages in a pagination query. If this parameter is not transferred, 50 sessions are displayed on each page by default. A maximum of 100 sessions can be displayed.

addr_prefix

No

String

Prefix of the address on the user side. It is a character string consisting of an IP address and port number. If this parameter is not transferred, all prefixes of addresses on the user side are queried by default.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

sessions

Array of objects

Instance sessions. For details, see Table 5.

total_count

Integer

Total sessions that meet search criteria.

Table 5 InstanceSession

Parameter

Type

Description

addr

String

IP address and port number of the client.

id

String

Client ID.

name

String

Client name, which is specified by running CLIENT SETNAME.

cmd

String

Last executed command.

age

String

Setup duration of the client connection, in seconds.

idle

String

Idle duration of the client connection, in seconds.

db

String

ID of the currently accessed database.

fd

String

File descriptor for sockets.

sub

String

Number of subscribed channels (Pub/Sub).

psub

String

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

multi

String

Number of commands contained in a MULTI or EXEC transaction.

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.