节点状态请求

返回节点的主机名和角色的请求。

Redis 企业软件
方法 路径 描述
获取 /v1/nodes/status 获取所有节点的状态
获取 /v1/nodes/{uid}/status 获取节点的状态

获取所有节点状态

GET /v1/nodes/status

获取所有节点的状态。包括集群中每个节点的主机名和角色:

  • 主节点返回"role": "master"

  • 副本节点返回"role": "slave"

所需权限

权限名称
view_node_info

请求

HTTP 请求示例

GET /v1/nodes/status

请求标头

钥匙 价值 描述
主机 cnm.cluster.fqdn 中 域名
接受 应用程序/JSON 接受的媒体类型

响应

对于集群中的每个节点,返回一个 JSON 对象,其中包含每个节点的主机名、角色和其他状态详细信息。

如果由于正在进行或未正确停止的节点维护过程而存在维护快照,则响应包括maintenance_snapshot田。

示例 JSON 正文

{
    "1": {
        "cores": 8,
        "free_provisional_ram": 0,
        "free_ram": 3499368448,
        "hostname": "3d99db1fdf4b",
        "maintenance_snapshot": {
            "created_time": "2024-09-06 20:47:23",
            "name": "maintenance_mode_2024-09-06_20-47-23",
            "node_uid": "1"
        },
        "master_shards": [],
        "node_overbooking_depth": 0,
        "node_status": "active",
        "role": "master",
        "slave_shards": [],
        "software_version": "7.4.6-22",
        "software_version_sha": "6c37b1483b5fb6110c8055c1526aa58eec1d29d3519e92310859101419248831",
        "total_memory": 6219673600,
        "total_provisional_ram": 0
    },
    "2": {
        "hostname": "fc7a3d332458",
        "role": "slave",
        // additional fields
    },
    "3": {
        "hostname": "b87cc06c830f",
        "role": "slave",
        // additional fields
    }
}

Status codes

Code Description
200 OK No error

Get node status

GET /v1/nodes/{int: uid}/status

Gets the status of a node. Includes the node's hostname and role in the cluster:

  • Primary nodes return "role": "master"

  • Replica nodes return "role": "slave"

Required permissions

Permission name
view_node_info

Request

Example HTTP request

GET /v1/nodes/1/status

Request headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

URL parameters

Field Type Description
uid integer The node's unique ID.

Response

Returns a JSON object that contains the node's hostname, role, and other status details.

If a maintenance snapshot exists due to an in-progress or improperly stopped node maintenance process, the response includes a maintenance_snapshot field.

Example JSON body

{
    "cores": 8,
    "free_provisional_ram": 0,
    "free_ram": 3504422912,
    "hostname": "3d99db1fdf4b",
    "maintenance_snapshot": {
        "created_time": "2024-09-06 20:47:23",
        "name": "maintenance_mode_2024-09-06_20-47-23",
        "node_uid": "1"
    },
    "master_shards": [],
    "node_overbooking_depth": 0,
    "node_status": "active",
    "role": "master",
    "slave_shards": [],
    "software_version": "7.4.6-22",
    "software_version_sha": "6c37b1483b5fb6110c8055c1526aa58eec1d29d3519e92310859101419248831",
    "total_memory": 6219673600,
    "total_provisional_ram": 0
}

Status codes

Code Description
200 OK No error
404 Not Found Node UID does not exist
RATE THIS PAGE
Back to top ↑