elasticsearch = cannot allocate because allocation is not permitted to any of the nodes

Viewed 15181

I have elasticsearch as a single node cluster.
One of the indexes is yellow with the explanation below.
I have read all the material here and in general, I did not find a solution for this problem. here is the index info:
yellow open research-pdl 8_TrwZieRM6oBes8sGBUWg 1 1 416656058 0 77.9gb 77.9gb

this command POST _cluster/reroute?retry_failed does not seems to be doing anything.

the setup is running on docker, I have 650GB free space.

{
  "index" : "research-pdl",
  "shard" : 0,
  "primary" : false,
  "current_state" : "unassigned",
  "unassigned_info" : {
    "reason" : "CLUSTER_RECOVERED",
    "at" : "2020-12-16T05:21:19.977Z",
    "last_allocation_status" : "no_attempt"
  },
  "can_allocate" : "no",
  "allocate_explanation" : "cannot allocate because allocation is not permitted to any of the nodes",
  "node_allocation_decisions" : [
    {
      "node_id" : "5zzXP2kCQ9eDI0U6WY4j9Q",
      "node_name" : "37f65704d9bb",
      "transport_address" : "172.19.0.2:9300",
      "node_attributes" : {
        "ml.machine_memory" : "67555622912",
        "xpack.installed" : "true",
        "transform.node" : "true",
        "ml.max_open_jobs" : "20"
      },
      "node_decision" : "no",
      "deciders" : [
        {
          "decider" : "same_shard",
          "decision" : "NO",
          "explanation" : "a copy of this shard is already allocated to this node [[research-pdl][0], node[5zzXP2kCQ9eDI0U6WY4j9Q], [P], s[STARTED], a[id=J7IX30jBSP2jXl5-IGp0BQ]]"
        }
      ]
    }
  ]
}

Thanks

1 Answers

The exception message is very clear, Elasticsearch never assigns the replica of the same primary shard on the same node for high availability reasons.

a copy of this shard is already allocated to this node [[research-pdl][0], node[5zzXP2kCQ9eDI0U6WY4j9Q], [P], s[STARTED], a[id=J7IX30jBSP2jXl5-IGp0BQ]]

And as you have a single node cluster, so you will not have another other node where your replicas can be assigned.

Solutions

  1. Add more nodes to your cluster, so that replicas can be assigned on other nodes. (preferred way)
  2. Reduce the replica shards to 0, this can cause data-loss and performance issues. (if at all, you don't have the option to add data-nodes and you want the green state for your cluster).

You can update the replica counts using cluster update API.

Related