# How to Fix Unallocated Shards?

**URL:** <https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434>\
**Category:** Elasticsearch\
**Created:** [January 23, 2017, 6:18am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434 "2017-01-23T06:18:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siva\_Sai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_sai/32/12249_2.png) [@Siva\_Sai](https://discuss.elastic.co/u/Siva_Sai)\
**Post date:** [January 23, 2017, 6:18am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/1 "2017-01-23T06:18:19Z")

</div>

now stuck at 75.2% curl -XGET -u elastic:changeme 'localhost:9200/\_cat/health?pretty' 1484915420 12:30:20 elasticsearch red 5 5 5656 2828 0 0 1870 0 - 75.2%

I can't fix it - tried to restore many times - gets up to 67.2% what do we do? restore from many days back? this shows many unallocated shards curl -XGET 'localhost:9200/\_cat/shards?pretty' -u elastic:

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 23, 2017, 8:43am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/2 "2017-01-23T08:43:43Z")

</div>

Please provide some more details. Which Elasticsearch version are you on? What its the size and specification of the cluster? How many indices/shards do you have and what is the total data volume?

What is the output of the [cat nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html)?

---

<div class="post-metadata">

**Author:** ![Siva\_Sai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_sai/32/12249_2.png) [@Siva\_Sai](https://discuss.elastic.co/u/Siva_Sai)\
**Post date:** [January 23, 2017, 9:54am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/3 "2017-01-23T09:54:06Z")

</div>

Elastic search version : 5.1.1  
Size and specification of the cluster: size: 6 specification: 2TB disk 16GB RAM CPUS : 6  
no.of shards: primary shards:2000+  
active shards: 5000+  
unassigned shards: 2000+

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 23, 2017, 9:57am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/4 "2017-01-23T09:57:00Z")

</div>

What is the output of the \_cat/nodes API?

---

<div class="post-metadata">

**Author:** ![Siva\_Sai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_sai/32/12249_2.png) [@Siva\_Sai](https://discuss.elastic.co/u/Siva_Sai)\
**Post date:** [January 23, 2017, 10:32am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/5 "2017-01-23T10:32:50Z")

</div>

![](https://us1.discourse-cdn.com/elastic/original/2X/4/459736cecfcc09450fa617b4706592b4a6ff6579.png)

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [January 23, 2017, 5:47pm UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/6 "2017-01-23T17:47:06Z")

</div>

You could also try the cluster allocation explain API:

[https://www.elastic.co/guide/en/elasticsearch/reference/5.1/cluster-allocation-explain.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/cluster-allocation-explain.html)

Determine which shard is unallocated and then do:

```
GET /_cluster/allocation/explain
{
  "index": "my_index",
  "shard": 0,
  "primary": false
}

```

Replace `my_index` with your index name, `0` with the shard number that is  
unassigned and `false` with `true` if the unassigned shard you wish to explain  
is a primary shard.

This should give you a nice output for why the shard is unassigned.

---

<div class="post-metadata">

**Author:** ![Siva\_Sai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_sai/32/12249_2.png) [@Siva\_Sai](https://discuss.elastic.co/u/Siva_Sai)\
**Post date:** [January 24, 2017, 6:04am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/7 "2017-01-24T06:04:54Z")

</div>

"the shard cannot be assigned because allocation deciders return a NO decision.  
primary shard for this replica is not yet active

unassigned:  
Reason: "cluster recovered"

---

<div class="post-metadata">

**Author:** ![Siva\_Sai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_sai/32/12249_2.png) [@Siva\_Sai](https://discuss.elastic.co/u/Siva_Sai)\
**Post date:** [January 24, 2017, 7:58am UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/8 "2017-01-24T07:58:22Z")

</div>

Please find the output attachment

![](https://us1.discourse-cdn.com/elastic/original/2X/5/5c6178768f4746a0591e27f20988a00f6de21905.jpg)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/e/e2b1af584ad7980d5b0a7f0149d2342a7298da61.jpg)

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [January 24, 2017, 7:27pm UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/9 "2017-01-24T19:27:44Z")

</div>

It looks like the primary copy of you should is stale, therefore there is no  
valid copy of the data that can be promoted to primary.

If you are curious, if you read more about stale shards here:  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-replication.html#\_failure\_handling](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-replication.html#_failure_handling)

By any chance, did this cluster experience a split brain due to two different  
masters? Was `minimum_master_nodes` configured correctly the entire time?

---

<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:** [February 21, 2017, 7:27pm UTC](https://discuss.elastic.co/t/how-to-fix-unallocated-shards/72434/10 "2017-02-21T19:27:48Z")

</div>

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