CLUSTER GETKEYSINSLOT
CLUSTER GETKEYSINSLOT slot count
- Available since:
- Redis Open Source 3.0.0
- Time complexity:
- O(N) where N is the number of requested keys
- ACL categories:
-
@slow, - Compatibility:
- Redis Software and Redis Cloud compatibility
The command returns key names stored on the contacted node that hash to the specified slot. Use the count argument to limit the number of keys returned, which lets you process keys in batches.
This command is mainly used when you reshard cluster slots from one node to another. For details, see the Redis Cluster specification or the appendix in the CLUSTER SETSLOT documentation.
Note:
During atomic slot migration operations (available since Redis 8.4.0), keys being imported or trimmed will be filtered out from the results.Required arguments
slot
The hash slot to return key names from.
count
The maximum number of key names to return.
Examples
> CLUSTER GETKEYSINSLOT 7000 3
1) "key_39015"
2) "key_89793"
3) "key_92937"
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ❌ Standard |
❌ Standard |
Return information
Array reply: an array with up to count elements.