Back to Redis

Index

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

latest6.6 KB
Original Source
MethodPathDescription
GET/v1/shardsGet all shards
GET/v1/shards/{uid}Get a specific shard

Get all shards {#get-all-shards}

GET /v1/shards

Get information about all shards in the cluster.

Request {#get-all-request}

Example HTTP request

GET /v1/shards?extra_info_keys=used_memory_rss&extra_info_keys=connected_clients

Request headers

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

Query parameters

FieldTypeDescription
extra_info_keyslist of stringsAn optional list of extra keys to be fetched from the Redis [INFO]({{< relref "/commands/info" >}}) command. See extra_info_keys for common keys to include.

Response {#get-all-response}

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

Example JSON body

json
[
  {
    "uid": "1",
    "role": "master",
    "assigned_slots": "0-16383",
    "bdb_uid": 1,
    "detailed_status": "ok",
    "loading": {
      "status": "idle"
    },
    "node_uid": "1",
    "redis_info": {
			"connected_clients": 14,
			"used_memory_rss": 12263424
		},
    "report_timestamp": "2024-06-28T18:44:01Z",
    "status": "active"
  },
  {
    "uid": "2",
    "role": "slave",
    // additional fields...
  }
]

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

CodeDescription
200 OKNo error.

Get shard {#get-shard}

GET /v1/shards/{int: uid}

Gets information about a single shard.

Request {#get-request}

Example HTTP request

GET /v1/shards/1?extra_info_keys=used_memory_rss&extra_info_keys=connected_clients

Request headers

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

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the requested shard.

Query parameters

FieldTypeDescription
extra_info_keyslist of stringsAn optional list of extra keys to be fetched from the Redis [INFO]({{< relref "/commands/info" >}}) command. See extra_info_keys for common keys to include.

Response {#get-response}

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

Example JSON body

json
{
  "assigned_slots": "0-16383",
  "bdb_uid": 1,
  "detailed_status": "ok",
  "loading": {
    "status": "idle"
  },
  "node_uid": "1",
  "redis_info": {
		"connected_clients": 14,
		"used_memory_rss": 12263424
	},
  "role": "master",
  "report_timestamp": "2024-06-28T18:44:01Z",
  "status": "active",
  "uid": "1"
}

Status codes {#get-status-codes}

CodeDescription
200 OKNo error.
404 Not FoundShard UID does not exist.

extra_info_keys

You can include any Redis [INFO]({{< relref "/commands/info" >}}) command key for shard requests using the extra_info_keys query parameter. The requested keys are returned in the redis_info object of the response.

See the following tables for common keys to include.

Client keys

KeyTypeDescription
blocked_clientsintegerNumber of clients pending on a blocking call
client_recent_max_input_bufferintegerBiggest input buffer among current client connections
client_recent_max_output_bufferintegerBiggest output buffer among current client connections
connected_clientsintegerNumber of client connections, excluding connections from replicas

Memory keys

KeyTypeDescription
maxmemoryintegerValue of the maxmemory configuration directive
used_memoryintegerTotal number of bytes allocated by Redis
used_memory_datasetintegerSize in bytes of the dataset
used_memory_luaintegerNumber of bytes used by the Lua engine
used_memory_overheadintegerSum of all overheads that the server allocated for managing its internal data structures
used_memory_peakintegerPeak memory in bytes consumed by Redis
used_memory_rssintegerNumber of bytes that Redis allocated as seen by the operating system

Persistence keys

KeyTypeDescription
aof_enabledintegerFlag indicating append-only file (AOF) logging is activated
aof_rewrite_in_progressintegerFlag indicating an AOF rewrite operation is on-going
rdb_bgsave_in_progressintegerFlag indicating an RDB save is on-going
rdb_changes_since_last_saveintegerNumber of changes since the last dump
rdb_last_bgsave_statusstringStatus of the last RDB save operation
rdb_last_save_timeintegerEpoch-based timestamp of last successful RDB save

Replication keys

KeyTypeDescription
master_last_io_seconds_agointegerNumber of seconds since the last interaction with the primary shard
master_repl_offsetintegerThe server's current replication offset
slave_repl_offsetintegerReplication offset of the replica instance

Server keys

KeyTypeDescription
configured_hzintegerServer's configured frequency setting
hzintegerServer's current frequency setting
redis_versionstringVersion of the Redis server
uptime_in_daysintegerNumber of days since Redis server start
uptime_in_secondsintegerNumber of seconds since Redis server start

Statistics keys

KeyTypeDescription
instantaneous_ops_per_secintegerNumber of commands processed per second
keyspace_hitsintegerNumber of successful lookup of keys in the main dictionary
keyspace_missesintegerNumber of failed lookup of keys in the main dictionary
total_commands_processedintegerTotal number of commands processed by the server
total_connections_receivedintegerTotal number of connections accepted by the server
total_net_input_bytesintegerTotal number of bytes read from the network
total_net_output_bytesintegerTotal number of bytes written to the network