ERR redis runtime_error ai_generated true

ERR Slot 1234 is not owned by this node

ID: redis/redis-cluster-slot-ownership-error

Also available as: JSON · Markdown · 中文
82%Fix Rate
87%Confidence
1Evidence
2024-01-25First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
redis 6.0 active
redis 6.2 active
redis 7.0 active
redis 7.2 active

Root Cause

A client sent a request to a Redis cluster node that does not own the requested hash slot, typically due to stale cluster configuration or incomplete slot migration.

generic

中文

客户端向不拥有请求哈希槽位的Redis集群节点发送请求,通常由于集群配置过时或槽位迁移未完成。

Official Documentation

https://redis.io/docs/latest/operate/oss_and_stack/management/scaling/

Workarounds

  1. 85% success Use `CLUSTER SETSLOT 1234 IMPORTING source-node-id` on the destination node and `CLUSTER SETSLOT 1234 MIGRATING destination-node-id` on the source, then run `redis-cli --cluster reshard <host>:<port> --from <source-id> --to <dest-id> --slots 1234` to migrate the slot.
    Use `CLUSTER SETSLOT 1234 IMPORTING source-node-id` on the destination node and `CLUSTER SETSLOT 1234 MIGRATING destination-node-id` on the source, then run `redis-cli --cluster reshard <host>:<port> --from <source-id> --to <dest-id> --slots 1234` to migrate the slot.
  2. 80% success Update client cluster configuration by calling `CLUSTER SLOTS` on a known node and reconfiguring the client's slot map, e.g., in redis-py: `r.cluster('slots')` to refresh.
    Update client cluster configuration by calling `CLUSTER SLOTS` on a known node and reconfiguring the client's slot map, e.g., in redis-py: `r.cluster('slots')` to refresh.
  3. 75% success If slot is unassigned, assign it to a node: `CLUSTER ADDSLOTS 1234` on the target node, then verify with `CLUSTER INFO`.
    If slot is unassigned, assign it to a node: `CLUSTER ADDSLOTS 1234` on the target node, then verify with `CLUSTER INFO`.

中文步骤

  1. Use `CLUSTER SETSLOT 1234 IMPORTING source-node-id` on the destination node and `CLUSTER SETSLOT 1234 MIGRATING destination-node-id` on the source, then run `redis-cli --cluster reshard <host>:<port> --from <source-id> --to <dest-id> --slots 1234` to migrate the slot.
  2. Update client cluster configuration by calling `CLUSTER SLOTS` on a known node and reconfiguring the client's slot map, e.g., in redis-py: `r.cluster('slots')` to refresh.
  3. If slot is unassigned, assign it to a node: `CLUSTER ADDSLOTS 1234` on the target node, then verify with `CLUSTER INFO`.

Dead Ends

Common approaches that don't work:

  1. Manually adding the slot to the node using CLUSTER ADDSLOTS 95% fail

    Adding slots without proper migration can cause data loss or inconsistency; CLUSTER ADDSLOTS is only safe for unassigned slots.

  2. Restarting the node 90% fail

    Restart does not update cluster topology; the node still does not own the slot unless a proper migration occurs.

  3. Flushing all data on the node 98% fail

    Deleting data does not reassign slots; the node remains without the slot, and data loss occurs.