{
  "schema_version": 2,
  "id": "commands/cluster-getkeysinslot",
  "title": "CLUSTER GETKEYSINSLOT",
  "url": "https://redis.io/docs/latest/commands/cluster-getkeysinslot/",
  "summary": "Returns the key names in a hash slot.",
  "since": "3.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:21+01:00",
  "page_type": "content",
  "content_hash": "b942ac26e559c219e0d09289c900104619c91d22352c395389e81f696ee14458",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "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.\n\nThis command is mainly used when you reshard cluster slots from one node to another. For details, see the [Redis Cluster specification](https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec) or the appendix in the [`CLUSTER SETSLOT`](https://redis.io/docs/latest/commands/cluster-setslot) documentation.\n\n> [!NOTE]\n> During atomic slot migration operations (available since Redis 8.4.0), keys being imported or trimmed will be filtered out from the results."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>slot</code></summary>\n\nThe hash slot to return key names from.\n\n</details>\n\n<details open><summary><code>count</code></summary>\n\nThe maximum number of key names to return.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): an array with up to count elements.\n\n**RESP3:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): an array with up to count elements."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "> CLUSTER GETKEYSINSLOT 7000 3\n1) \"key_39015\"\n2) \"key_89793\"\n3) \"key_92937\"",
      "section_id": "examples"
    }
  ]
}
