Back to Redis

Index

content/operate/rs/references/rest-api/requests/nodes/_index.md

latest7.0 KB
Original Source
MethodPathDescription
GET/v1/nodesGet all cluster nodes
GET/v1/nodes/{uid}Get a single cluster node
PUT/v1/nodes/{uid}Update a node

Get all nodes {#get-all-nodes}

sh
GET /v1/nodes

Get all cluster nodes.

Permissions

Permission nameRoles
[view_all_nodes_info]({{< relref "/operate/rs/references/rest-api/permissions#view_all_nodes_info" >}})admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager

Request {#get-all-request}

Example HTTP request

sh
GET /v1/nodes

Headers

KeyValueDescription
Hostcnm.cluster.fqdnDomain name
Acceptapplication/jsonAccepted media type

Response {#get-all-response}

Returns a JSON array of [node objects]({{< relref "/operate/rs/references/rest-api/objects/node" >}}).

Example JSON body

json
[
    {
      "uid": 1,
      "status": "active",
      "uptime": 262735,
      "total_memory": 6260334592,
      "software_version": "0.90.0-1",
      "ephemeral_storage_size": 20639797248,
      "persistent_storage_path": "/var/opt/redislabs/persist",
      "persistent_storage_size": 20639797248,
      "os_version": "Ubuntu 14.04.2 LTS",
      "ephemeral_storage_path": "/var/opt/redislabs/tmp",
      "architecture": "x86_64",
      "shard_count": 23,
      "public_addr": "",
      "cores": 4,
      "rack_id": "",
      "supported_database_versions": [
        {
          "db_type": "memcached",
          "version": "1.4.17"
        },
        {
          "db_type": "redis",
          "version": "2.6.16"
        },
        {
          "db_type": "redis",
          "version": "2.8.19"
        }
      ],
      "shard_list": [1, 3, 4],
      "addr": "10.0.3.61"
    },
    {
      "uid": 1,
      "status": "active",
      "// additional fields..."
    }
]

Status codes {#get-all-status-codes}

CodeDescription
200 OKNo error

Get node {#get-node}

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

Get a single cluster node.

Permissions

Permission nameRoles
[view_node_info]({{< relref "/operate/rs/references/rest-api/permissions#view_node_info" >}})admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager

Request {#get-request}

Example HTTP request

sh
GET /v1/nodes/1

Headers

KeyValueDescription
Hostcnm.cluster.fqdnDomain name
Acceptapplication/jsonAccepted media type

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the node requested.

Response {#get-response}

Returns a [node object]({{< relref "/operate/rs/references/rest-api/objects/node" >}}).

Example JSON body

json
{
    "uid": 1,
    "name": "node:1",
    "// additional fields..."
}

Status codes {#get-status-codes}

CodeDescription
200 OKNo error
404 Not FoundNode UID does not exist

Update node {#put-node}

sh
PUT /v1/nodes/{int: uid}

Update a [node object]({{< relref "/operate/rs/references/rest-api/objects/node" >}}).

Currently, you can edit the following attributes:

FieldType/ValueDescription
accept_serversboolean (default: true)The node only accepts new shards if accept_servers is true
addrstringInternal IP address of node
external_addrcomplex objectExternal IP addresses of node. GET /v1/jsonschema to retrieve the object's structure.
max_listenersintegerMaximum number of listeners on the node
max_redis_forksinteger (default: -1)Maximum number of background processes forked from shards that can exist on the node at any given time. Set to 0 for unlimited. Set to -1 to use cluster settings.
max_redis_serversintegerMaximum number of shards on the node
max_slave_full_syncsinteger (default: -1)Maximum number of simultaneous replica full syncs that can run at any given time. Set to 0 for unlimited. Set to -1 to use cluster settings.
rack_idstringRack ID where node is installed
recovery_pathstringRecovery files path
second_rack_idstringSecond rack ID where node is installed

{{<note>}} You can only update the addr attribute for offline nodes. Otherwise, the request returns an error. {{</note>}}

Permissions

Permission nameRoles
[update_node]({{< relref "/operate/rs/references/rest-api/permissions#update_node" >}})admin

Request {#put-request}

Example HTTP request

sh
PUT /v1/nodes/1

Example JSON body

json
{
    "addr": "10.0.0.1",
    "external_addr" : [
        "192.0.2.24"
    ]
}

Request headers

KeyValueDescription
Hostcluster.fqdnDomain name
Acceptapplication/jsonAccepted media type
Content-Typeapplication/jsonMedia type of request/response body

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the updated node.

Body

FieldTypeDescription
addrstringInternal IP address of node
external_addrJSON arrayExternal IP addresses of the node
recovery_pathstringPath for recovery files
accept_serversbooleanIf true, no shards will be created on the node

Response {#put-response}

If the request is successful, the body will be empty. Otherwise, it may contain a JSON object with an error code and error message.

Status codes {#put-status-codes}

CodeDescription
200 OKNo error, the request has been processed.
406 Not AcceptableUpdate request cannot be processed.
400 Bad RequestBad content provided.

Error codes {#put-error-codes}

CodeDescription
node_not_foundNode does not exist
node_not_offlineAttempted to change node address while it is online
node_already_populatedThe node contains shards or endpoints, cannot disable accept_servers
invalid_oss_cluster_port_mappingCannot enable "accept_servers" since there are databases with "oss_cluster_port_mapping" that do not have a port configuration for the current node
node_already_has_rack_idAttempted to change node's rack_id when it already has one