|
| 1 | +--- |
| 2 | +arguments: |
| 3 | +- arguments: |
| 4 | + - arguments: |
| 5 | + - name: start-slot |
| 6 | + type: integer |
| 7 | + - name: end-slot |
| 8 | + type: integer |
| 9 | + name: slotsrange |
| 10 | + token: SLOTSRANGE |
| 11 | + type: block |
| 12 | + - arguments: |
| 13 | + - name: metric |
| 14 | + type: string |
| 15 | + - name: limit |
| 16 | + optional: true |
| 17 | + token: LIMIT |
| 18 | + type: integer |
| 19 | + - arguments: |
| 20 | + - name: asc |
| 21 | + token: ASC |
| 22 | + type: pure-token |
| 23 | + - name: desc |
| 24 | + token: DESC |
| 25 | + type: pure-token |
| 26 | + name: order |
| 27 | + optional: true |
| 28 | + type: oneof |
| 29 | + name: orderby |
| 30 | + token: ORDERBY |
| 31 | + type: block |
| 32 | + name: filter |
| 33 | + type: oneof |
| 34 | +arity: -4 |
| 35 | +categories: |
| 36 | +- docs |
| 37 | +- develop |
| 38 | +- stack |
| 39 | +- oss |
| 40 | +- rs |
| 41 | +- rc |
| 42 | +- oss |
| 43 | +- kubernetes |
| 44 | +- clients |
| 45 | +command_flags: |
| 46 | +- STALE |
| 47 | +- LOADING |
| 48 | +command_tips: |
| 49 | +- NONDETERMINISTIC_OUTPUT |
| 50 | +- REQUEST_POLICY:ALL_SHARDS |
| 51 | +complexity: O(N) where N is the total number of slots based on arguments. O(N*log(N)) |
| 52 | + with ORDERBY subcommand. |
| 53 | +container: CLUSTER |
| 54 | +description: Return an array of slot usage statistics for slots assigned to the current |
| 55 | + node. |
| 56 | +function: clusterSlotStatsCommand |
| 57 | +group: cluster |
| 58 | +hidden: false |
| 59 | +linkTitle: CLUSTER SLOT-STATS |
| 60 | +reply_schema: |
| 61 | + description: Array of nested arrays, where the inner array element represents a |
| 62 | + slot and its respective usage statistics. |
| 63 | + items: |
| 64 | + description: Array of size 2, where 0th index represents (int) slot and 1st index |
| 65 | + represents (map) usage statistics. |
| 66 | + items: |
| 67 | + - description: Slot Number. |
| 68 | + type: integer |
| 69 | + - additionalProperties: false |
| 70 | + description: Map of slot usage statistics. |
| 71 | + properties: |
| 72 | + cpu-usec: |
| 73 | + type: integer |
| 74 | + key-count: |
| 75 | + type: integer |
| 76 | + network-bytes-in: |
| 77 | + type: integer |
| 78 | + network-bytes-out: |
| 79 | + type: integer |
| 80 | + type: object |
| 81 | + maxItems: 2 |
| 82 | + minItems: 2 |
| 83 | + type: array |
| 84 | + type: array |
| 85 | +since: 8.2.0 |
| 86 | +summary: Return an array of slot usage statistics for slots assigned to the current |
| 87 | + node. |
| 88 | +syntax_fmt: "CLUSTER SLOT-STATS <SLOTSRANGE\_start-slot end-slot | ORDERBY\_metric\n [LIMIT\_\ |
| 89 | + limit] [ASC | DESC]>" |
| 90 | +syntax_str: '' |
| 91 | +title: CLUSTER SLOT-STATS |
| 92 | +--- |
| 93 | + |
| 94 | +Use this command to get an array of slot usage statistics for the slots assigned to the current shard. If you're working with a Redis cluster, this data helps you understand overall slot usage, spot hot or cold slots, plan slot migrations to balance load, or refine your application logic to better distribute keys. |
| 95 | + |
| 96 | +## Options |
| 97 | + |
| 98 | +`CLUSTER SLOT-STATS` has two mutually exclusive options: |
| 99 | + |
| 100 | +* `ORDERBY`: Sorts the slot statistics by the specified metric. Use ASC or DESC to sort in ascending or descending order. If multiple slots have the same value, the command uses the slot number as a tiebreaker, sorted in ascending order. |
| 101 | + |
| 102 | +* `SLOTSRANGE`: Limits the results to a specific, inclusive range of slots. Results are always sorted by slot number in ascending order. |
| 103 | + |
| 104 | +The command reports on the following statistics: |
| 105 | + |
| 106 | +* `KEY-COUNT`: Number of keys stored in the slot. |
| 107 | +* `CPU-USEC`: CPU time (in microseconds) spent handling the slot. |
| 108 | +* `NETWORK-BYTES-IN`: Total inbound network traffic (in bytes) received by the slot. |
| 109 | +* `NETWORK-BYTES-OUT`: Total outbound network traffic (in bytes) sent from the slot. |
| 110 | + |
| 111 | +## Return information |
| 112 | + |
| 113 | +{{< multitabs id=“cmd-name-return-info" |
| 114 | + tab1="RESP2" |
| 115 | + tab2="RESP3" >}} |
| 116 | + |
| 117 | +One of the following: |
| 118 | + |
| 119 | +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a nested list of slot usage statistics. |
| 120 | +* [Simple error]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) otherwise. |
| 121 | + |
| 122 | +-tab-sep- |
| 123 | + |
| 124 | +One of the following: |
| 125 | + |
| 126 | +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a nested list of slot usage statistics. |
| 127 | +* [Simple error]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) otherwise. |
| 128 | + |
| 129 | +{{< /multitabs >}} |
0 commit comments