All Products
Search
Document Center

Database Autonomy Service:GetRedisAllSession

Last Updated:Jun 10, 2026

Mengkueri sesi saat ini pada instans ApsaraDB for Redis.

Deskripsi operasi

  • Operasi ini hanya berlaku untuk instans ApsaraDB for Redis.

  • Jika Anda menggunakan SDK untuk memanggil operasi Database Autonomy Service (DAS), Anda harus menetapkan ID region ke cn-shanghai.

Catatan

Operasi ini tidak dapat digunakan untuk mengkueri sesi yang dihasilkan dalam mode koneksi langsung pada instans klaster ApsaraDB for Redis.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

hdm:GetRedisAllSession

get

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

ConsoleContext

string

No

Parameter cadangan.

None

InstanceId

string

Yes

ID instans database.

r-2zemyfd1sh1u2i****

Elemen respons

Element

Type

Description

Example

object

Parameter respons.

Code

integer

Kode status HTTP yang dikembalikan.

200

Message

string

Pesan yang dikembalikan.

Catatan

Jika permintaan berhasil, Successful akan dikembalikan. Jika permintaan gagal, pesan kesalahan seperti kode kesalahan akan dikembalikan.

Successful

Data

object

Data sesi.

Timestamp

integer

Waktu saat sesi instans dikembalikan. Nilainya berupa stempel waktu UNIX yang merepresentasikan jumlah milidetik yang telah berlalu sejak 1 Januari 1970, 00:00:00 UTC.

1660100753556

Total

integer

Jumlah total sesi.

2

Sessions

array<object>

Informasi tentang sesi.

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>

Statistik tentang sumber akses.

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

ID permintaan.

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

Success

boolean

Menunjukkan apakah permintaan berhasil. Nilai yang valid:

  • true

  • false

true

Contoh

Respons sukses

JSONformat

{
  "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
}

Kode kesalahan

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.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.