{
  "id": "communication/redis-cluster-moved-redirect",
  "signature": "MOVED 12182 10.0.0.1:6379: Redis cluster redirect to different node",
  "signature_zh": "MOVED 12182 10.0.0.1:6379：Redis 集群重定向到不同节点",
  "regex": "MOVED\\s+\\d+\\s+[\\d.]+:\\d+",
  "domain": "communication",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "Redis cluster client sent a command to a node that does not own the key's hash slot, and the client is not using smart client-side routing or cluster-aware connection pooling.",
  "root_cause_type": "generic",
  "root_cause_zh": "Redis 集群客户端将命令发送到不拥有该键哈希槽的节点，且客户端未使用智能客户端路由或集群感知的连接池。",
  "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"
    },
    {
      "version": "ioredis 5.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "redis-py 4.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Manually redirect the client to the node IP in the MOVED error without updating the cluster topology",
      "why_fails": "The cluster topology may change again; manual redirection is not scalable and can cause further MOVED errors.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable cluster mode and connect to a single Redis instance",
      "why_fails": "Defeats the purpose of clustering; data may be incomplete or inconsistent across nodes.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase connection timeout in client configuration",
      "why_fails": "Timeout does not address the routing issue; MOVED is a protocol-level redirect, not a timeout.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a Redis cluster-aware client library that automatically handles MOVED redirections, e.g., ioredis Cluster: `new Redis.Cluster([{ host: '10.0.0.1', port: 6379 }])` which maintains a slot-to-node mapping.",
      "success_rate": 0.95,
      "how": "Use a Redis cluster-aware client library that automatically handles MOVED redirections, e.g., ioredis Cluster: `new Redis.Cluster([{ host: '10.0.0.1', port: 6379 }])` which maintains a slot-to-node mapping.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Enable cluster mode in the client configuration with automatic slot refresh, e.g., in redis-py: `rediscluster.RedisCluster(startup_nodes=[{'host':'10.0.0.1','port':6379}], skip_full_coverage_check=True)`.",
      "success_rate": 0.9,
      "how": "Enable cluster mode in the client configuration with automatic slot refresh, e.g., in redis-py: `rediscluster.RedisCluster(startup_nodes=[{'host':'10.0.0.1','port':6379}], skip_full_coverage_check=True)`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using a non-cluster-aware client, implement manual retry with slot calculation: compute the hash slot for the key using CRC16 modulo 16384, then connect to the correct node directly.",
      "success_rate": 0.75,
      "how": "If using a non-cluster-aware client, implement manual retry with slot calculation: compute the hash slot for the key using CRC16 modulo 16384, then connect to the correct node directly.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用支持 Redis 集群的客户端库自动处理 MOVED 重定向，例如 ioredis Cluster：`new Redis.Cluster([{ host: '10.0.0.1', port: 6379 }])`，它会维护槽到节点的映射。",
    "在客户端配置中启用集群模式并自动刷新槽信息，例如在 redis-py 中：`rediscluster.RedisCluster(startup_nodes=[{'host':'10.0.0.1','port':6379}], skip_full_coverage_check=True)`。",
    "如果使用非集群感知客户端，实现手动重试并计算槽位：使用 CRC16 对键取模 16384 计算哈希槽，然后直接连接到正确节点。"
  ],
  "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": "MOVED",
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-09-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}