{
  "id": "elasticsearch/primary-shard-not-allocated-due-to-rack-awareness",
  "signature": "ClusterHealthResponse: status=RED, unassigned_shards=5, reason=ALLOCATION_FAILED due to [1] shards not allocated because of rack awareness constraints",
  "signature_zh": "集群健康状态: RED, 未分配分片=5, 原因=由于机架感知约束导致分配失败",
  "regex": "ClusterHealthResponse: status=RED, unassigned_shards=\\d+, reason=ALLOCATION_FAILED due to.*rack awareness",
  "domain": "elasticsearch",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Rack awareness allocation filtering prevents primary shard allocation because no node in the required rack has enough disk space or is available.",
  "root_cause_type": "generic",
  "root_cause_zh": "机架感知分配过滤阻止主分片分配，因为所需机架中没有节点具有足够的磁盘空间或可用。",
  "versions": [
    {
      "version": "7.17.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.12.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The issue is not overall disk space but the specific rack's node availability; increasing space on nodes in other racks does not satisfy the allocation filter",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Re-creating the index with fewer shards does not address the rack awareness constraint; the new primary shards will still fail to allocate if the same rack is unavailable",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Temporarily disable rack awareness allocation filtering: PUT _cluster/settings { \"transient\": { \"cluster.routing.allocation.awareness.attributes\": \"\" } } then re-enable after shards allocate",
      "success_rate": 0.9,
      "how": "Temporarily disable rack awareness allocation filtering: PUT _cluster/settings { \"transient\": { \"cluster.routing.allocation.awareness.attributes\": \"\" } } then re-enable after shards allocate",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a node in the required rack and ensure it has sufficient disk space, then use the cluster rebalance API: POST _cluster/reroute?retry_failed=true",
      "success_rate": 0.95,
      "how": "Add a node in the required rack and ensure it has sufficient disk space, then use the cluster rebalance API: POST _cluster/reroute?retry_failed=true",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "临时禁用机架感知分配过滤：PUT _cluster/settings { \"transient\": { \"cluster.routing.allocation.awareness.attributes\": \"\" } }，分片分配后再重新启用",
    "在所需机架中添加一个节点并确保其有足够的磁盘空间，然后使用集群重路由API：POST _cluster/reroute?retry_failed=true"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cluster.html#cluster-allocation-awareness",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.78,
  "resolvable": "partial",
  "first_seen": "2024-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}