# Unnasigned shards for replica

**URL:** https://discuss.elastic.co/t/unnasigned-shards-for-replica/307792
**Category:** Elasticsearch
**Created:** [June 21, 2022, 6:55pm UTC](https://discuss.elastic.co/t/unnasigned-shards-for-replica/307792 "2022-06-21T18:55:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![INS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ins/32/92827_2.png) [@INS](https://discuss.elastic.co/u/INS)
#### Post date: [June 21, 2022, 6:55pm UTC](https://discuss.elastic.co/t/unnasigned-shards-for-replica/307792/1 "2022-06-21T18:55:43Z")

</div>

Hi  
How can I reassign (UNASSIGNED) shards for replica ?

```auto
logstash-prod1-2022.06.21 3 p STARTED 2833524 es_data_ssd_5_1
logstash-prod1-2022.06.21 3 r UNASSIGNED

```

I have tried through below req:

```auto
POST /_cluster/reroute
{
  "commands": [

    {
      "allocate_replica": {
        "index": "logstash-prod1-2022.06.21", "shard": 3,
        "node": "es_data_ssd_5_1"
      }
    }
  ]
}

```

but it got the error

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "[allocate_replica] allocation of [logstash-prod1-2022.06.21][3] on node {es_data_ssd_5_1}{XMyLrsVFSJiKSs-yUhZkgA}{-gwnp-iZTYKaMlpgb6zBFQ}{10.0.9.102}{10.0.9.102:9300}{hs}{rack_id=rack_one, xpack.installed=true} is not allowed, reason: [YES(shard has failed allocating [5] times but [5] retries are allowed)][YES(primary shard for this replica is already active)][YES(explicitly ignoring any disabling of allocation due to manual allocation commands via the reroute API)][YES(can allocate replica shard to a node with version [8.1.0] since this is equal-or-newer than the primary version [8.1.0])][YES(the shard is not being snapshotted)][YES(ignored as shard is not being recovered from a snapshot)][YES(this node is not currently shutting down)][YES(neither the source nor target node are part of an ongoing node replacement (no replacements))][YES(node passes include/exclude/require filters)][NO(a copy of this shard is already allocated to this node [[logstash-prod1-2022.06.21][3], node[XMyLrsVFSJiKSs-yUhZkgA], [P], s[STARTED], a[id=lPEKLoF2QIK6n6HCChh6mw]])][YES(enough disk for shard on node, free: [1.3tb], shard size: [0b], free after allocating shard: [1.3tb])][YES(below shard recovery limit of outgoing: [0 < 2] incoming: [0 < 2])][YES(total shard limits are disabled: [index: -1, cluster: -1] <= 0)][NO(there are [2] copies of this shard and [3] values for attribute [rack_id] ([rack_one, rack_three, rack_two] from nodes in the cluster and no forced awareness) so there may be at most [1] copies of this shard allocated to nodes with each value, but (including this copy) there would be [2] copies allocated to nodes with [node.attr.rack_id: rack_one])][YES(index has a preference for tiers [data_content] and node has tier [data_content])][YES(shard is not a follower and is not under the purview of this decider)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this decider only applies to indices backed by searchable snapshots)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this node's data roles are not exactly [data_frozen] so it is not a dedicated frozen node)]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "[allocate_replica] allocation of [logstash-prod1-2022.06.21][3] on node {es_data_ssd_5_1}{XMyLrsVFSJiKSs-yUhZkgA}{-gwnp-iZTYKaMlpgb6zBFQ}{10.0.9.102}{10.0.9.102:9300}{hs}{rack_id=rack_one, xpack.installed=true} is not allowed, reason: [YES(shard has failed allocating [5] times but [5] retries are allowed)][YES(primary shard for this replica is already active)][YES(explicitly ignoring any disabling of allocation due to manual allocation commands via the reroute API)][YES(can allocate replica shard to a node with version [8.1.0] since this is equal-or-newer than the primary version [8.1.0])][YES(the shard is not being snapshotted)][YES(ignored as shard is not being recovered from a snapshot)][YES(this node is not currently shutting down)][YES(neither the source nor target node are part of an ongoing node replacement (no replacements))][YES(node passes include/exclude/require filters)][NO(a copy of this shard is already allocated to this node [[logstash-prod1-2022.06.21][0], node[XMyLrsVFSJiKSs-yUhZkgA], [P], s[STARTED], a[id=lPEKLoF2QIK6n6HCChh6mw]])][YES(enough disk for shard on node, free: [1.3tb], shard size: [0b], free after allocating shard: [1.3tb])][YES(below shard recovery limit of outgoing: [0 < 2] incoming: [0 < 2])][YES(total shard limits are disabled: [index: -1, cluster: -1] <= 0)][NO(there are [2] copies of this shard and [3] values for attribute [rack_id] ([rack_one, rack_three, rack_two] from nodes in the cluster and no forced awareness) so there may be at most [1] copies of this shard allocated to nodes with each value, but (including this copy) there would be [2] copies allocated to nodes with [node.attr.rack_id: rack_one])][YES(index has a preference for tiers [data_content] and node has tier [data_content])][YES(shard is not a follower and is not under the purview of this decider)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this decider only applies to indices backed by searchable snapshots)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this node's data roles are not exactly [data_frozen] so it is not a dedicated frozen node)]"
  },
  "status" : 400
}

```

after that it was also increased index.allocation.max\_retries from 5 to 7

but once again got error

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "[allocate_replica] all copies of [logstash-prod1-2022.06.21][3] are already assigned. Use the move allocation command instead"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "[allocate_replica] all copies of [logstash-prod1-2022.06.211][3] are already assigned. Use the move allocation command instead"
  },
  "status" : 400
}

```

What's wrong?

---

<div class="post-metadata">

### Author: ![INS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ins/32/92827_2.png) [@INS](https://discuss.elastic.co/u/INS)
#### Post date: [June 21, 2022, 7:43pm UTC](https://discuss.elastic.co/t/unnasigned-shards-for-replica/307792/2 "2022-06-21T19:43:15Z")

</div>

Ok already found the root cause: after setting null for allocation and enable once again it was solved allocation

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 19, 2022, 7:44pm UTC](https://discuss.elastic.co/t/unnasigned-shards-for-replica/307792/3 "2022-07-19T19:44:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
