Obtaining Instance Sessions
Function
This API is used to obtain instance sessions.
Constraints
This API supports the following instance:
- GeminiDB Redis
Authorization Information
Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
gaussdbfornosql:instance:listSession
List
instance *
- g:ResourceTag/<tag-key>
- g:EnterpriseProjectId
nosql:session:list
-
URI
GET /v3/{project_id}/instances/{instance_id}/sessions
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
|
instance_id |
Yes |
String |
Definition Instance ID Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
node_id |
No |
String |
Definition Node ID Constraints N/A Range N/A Default Value N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token To obtain this value, call the IAM API for obtaining a user token. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
node_sessions |
Array of objects in Table 5 |
Definition Node sessions Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
node_id |
String |
Definition Node ID Range N/A |
|
total_count |
Integer |
Definition Total number of sessions Range N/A |
|
sessions |
Array of objects in Table 6 |
Definition Node session details Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition Session ID Range N/A |
|
name |
String |
Definition Connection name Range N/A |
|
cmd |
String |
Definition Last executed command Range N/A |
|
age |
String |
Definition Connection duration (seconds) Range N/A |
|
idle |
String |
Definition Idle duration (seconds) Range N/A |
|
db |
String |
Definition ID of a database that is being used by a client Range N/A |
|
addr |
String |
Definition IP address and port of a client Range N/A |
|
fd |
String |
Definition File descriptor for sockets Range N/A |
|
sub |
String |
Definition Number of subscribed channels Range N/A |
|
psub |
String |
Definition Number of subscribed modes Range N/A |
|
multi |
String |
Definition Number of commands executed in a transaction Range N/A |
Example Requests
- Querying sessions of all nodes on an instance
GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/e73893ef73754465a8bd2e0857bbf13ein12/sessions - Querying sessions of a specified node on an instance
GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/e73893ef73754465a8bd2e0857bbf13ein12/sessions?node_id=9d3288bbbb81448e8a99ff41a5717281no12
Example Responses
Status code: 200
Successful response
{
"node_sessions" : [ {
"node_id" : "8436a91546294036b75931e879882200in06",
"total_count" : 1,
"sessions" : [ {
"addr" : "127.0.0.1:8080",
"id" : 54487,
"name" : "cli",
"cmd" : "get",
"age" : 8888581,
"idle" : 8888581,
"db" : 0,
"fd" : 1311,
"sub" : 0,
"psub" : 0,
"multi" : -1
} ]
}, {
"node_id" : "8123sa46294daw13def423fw79882200in06",
"total_count" : 1,
"sessions" : [ {
"addr" : "127.0.0.1:8080",
"id" : 54488,
"name" : "cli",
"cmd" : "get",
"age" : 3124124,
"idle" : 4414141,
"db" : 0,
"fd" : 1312,
"sub" : 0,
"psub" : 0,
"multi" : -1
} ]
} ]
}
Status Codes
For details, see Status Codes.
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot