ERR redis runtime_error ai_generated true

错误:槽位1234不属于此节点

ERR Slot 1234 is not owned by this node

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

其他格式: JSON · Markdown 中文 · English
82%修复率
87%置信度
1证据数
2024-01-25首次发现

版本兼容性

版本状态引入弃用备注
redis 6.0 active
redis 6.2 active
redis 7.0 active
redis 7.2 active

根因分析

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

English

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

官方文档

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

解决方案

  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`.

无效尝试

常见但无效的做法:

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

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

  2. Restarting the node 90% 失败

    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% 失败

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