{
  "id": "database/redis-cluster-slot-migration",
  "signature": "redis.exceptions.ResponseError: MOVED 1234 192.168.1.1:6379",
  "signature_zh": "redis.exceptions.ResponseError：MOVED 1234 192.168.1.1:6379",
  "regex": "redis\\.exceptions\\.ResponseError: MOVED \\d+ \\d+\\.\\d+\\.\\d+\\.\\d+:\\d+",
  "domain": "database",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "Redis Cluster client sent a request to the wrong node for a given hash slot; the node responds with MOVED redirection indicating the correct node, but the client is not using cluster-aware routing or the cluster topology has changed.",
  "root_cause_type": "generic",
  "root_cause_zh": "Redis 集群客户端将请求发送到错误的节点以获取给定的哈希槽；节点响应 MOVED 重定向指示正确的节点，但客户端未使用集群感知路由或集群拓扑已更改。",
  "versions": [
    {
      "version": "Redis 6.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Redis 7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Redis 7.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The client will keep hitting the same wrong node and get MOVED errors repeatedly; the slots must be refreshed.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This can break cluster consistency; the slot might be owned by another node, causing data loss or split-brain.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This treats the cluster as a standalone instance; MOVED errors will still occur for keys in non-local slots.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Switch from redis.StrictRedis to redis.cluster.RedisCluster: from redis.cluster import RedisCluster; rc = RedisCluster(host='mycluster', port=6379). This handles MOVED redirections automatically.",
      "success_rate": 0.95,
      "how": "Switch from redis.StrictRedis to redis.cluster.RedisCluster: from redis.cluster import RedisCluster; rc = RedisCluster(host='mycluster', port=6379). This handles MOVED redirections automatically.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Call rc.cluster_slots() or use the CLUSTER SLOTS command to get current slot-to-node mapping, then update client routing table.",
      "success_rate": 0.85,
      "how": "Call rc.cluster_slots() or use the CLUSTER SLOTS command to get current slot-to-node mapping, then update client routing table.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Run redis-cli -h any_node CLUSTER NODES to see all nodes and slots. If slots are missing, rebalance: redis-cli --cluster rebalance 192.168.1.1:6379.",
      "success_rate": 0.8,
      "how": "Run redis-cli -h any_node CLUSTER NODES to see all nodes and slots. If slots are missing, rebalance: redis-cli --cluster rebalance 192.168.1.1:6379.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Switch from redis.StrictRedis to redis.cluster.RedisCluster: from redis.cluster import RedisCluster; rc = RedisCluster(host='mycluster', port=6379). This handles MOVED redirections automatically.",
    "Call rc.cluster_slots() or use the CLUSTER SLOTS command to get current slot-to-node mapping, then update client routing table.",
    "Run redis-cli -h any_node CLUSTER NODES to see all nodes and slots. If slots are missing, rebalance: redis-cli --cluster rebalance 192.168.1.1:6379."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://redis.io/docs/reference/cluster-spec/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-08-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}