# All of my shards suddenly unassigned

**URL:** <https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064>\
**Category:** Elasticsearch\
**Created:** [March 22, 2016, 5:49am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064 "2016-03-22T05:49:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [March 22, 2016, 5:49am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/1 "2016-03-22T05:49:10Z")

</div>

I am running a single node of elasticsearch 2.2, and upon restarting the node all of the sudden all the shards got unassigned. This is the cluster health stats:

> ```
> {
> "cluster_name" : "elasticsearch",
> "status" : "red",
> "timed_out" : false,
> "number_of_nodes" : 1,
> "number_of_data_nodes" : 1,
> "active_primary_shards" : 0,
> "active_shards" : 0,
> "relocating_shards" : 0,
> "initializing_shards" : 4,
> "unassigned_shards" : 108,
> "delayed_unassigned_shards" : 0,
> "number_of_pending_tasks" : 0,
> "number_of_in_flight_fetch" : 0,
> "task_max_waiting_in_queue_millis" : 0,
> "active_shards_percent_as_number" : 0.0
> }
> 
> ```

I've read about this problem happening on SOME of the shards on a multiple nodes cluster but I'm running a much simpler instance and this seems realy weird.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 22, 2016, 6:15am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/2 "2016-03-22T06:15:34Z")

</div>

What do you have in logs?

---

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [March 22, 2016, 6:33am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/3 "2016-03-22T06:33:46Z")

</div>

it keeps filling up with these:

> Caused by: java.nio.file.NoSuchFileException: C:\Users\tc99138\Desktop\elasticsearch\data\elasticsearch\nodes\0\indices\logstash-de\0\index\_u\_Lucene50\_0.tip  
> at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)  
> at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)  
> at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)  
> at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:115)  
> at java.nio.channels.FileChannel.open(FileChannel.java:287)  
> at java.nio.channels.FileChannel.open(FileChannel.java:335)  
> at org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:238)  
> at org.apache.lucene.store.FilterDirectory.openInput(FilterDirectory.java:89)  
> at org.apache.lucene.store.FilterDirectory.openInput(FilterDirectory.java:89)  
> at org.apache.lucene.codecs.blocktree.BlockTreeTermsReader.(BlockTreeTermsReader.java:173)  
> at org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.fieldsProducer(Lucene50PostingsFormat.java:446)  
> at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsReader.(PerFieldPostingsFormat.java:261)  
> at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat.fieldsProducer(PerFieldPostingsFormat.java:341)  
> at org.apache.lucene.index.SegmentCoreReaders.(SegmentCoreReaders.java:104)  
> at org.apache.lucene.index.SegmentReader.(SegmentReader.java:65)  
> at org.apache.lucene.index.ReadersAndUpdates.getReader(ReadersAndUpdates.java:145)  
> at org.apache.lucene.index.ReadersAndUpdates.getReadOnlyClone(ReadersAndUpdates.java:197)  
> at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:99)  
> at org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:435)  
> at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:86)  
> at org.elasticsearch.index.engine.InternalEngine.createSearcherManager(InternalEngine.java:296)  
> ... 12 more

---

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [March 22, 2016, 6:59am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/4 "2016-03-22T06:59:16Z")

</div>

I tried deleting the index logstash-de, and now this is the health status:

> {  
> "cluster\_name" : "elasticsearch",  
> "status" : "red",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 1,  
> "number\_of\_data\_nodes" : 1,  
> "active\_primary\_shards" : 50,  
> "active\_shards" : 50,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 52,  
> "delayed\_unassigned\_shards" : 0,  
> "number\_of\_pending\_tasks" : 0,  
> "number\_of\_in\_flight\_fetch" : 0,  
> "task\_max\_waiting\_in\_queue\_millis" : 0,  
> "active\_shards\_percent\_as\_number" : 49.01960784313725  
> }

only the replica shards are unassigned

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 22, 2016, 8:32am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/5 "2016-03-22T08:32:37Z")

</div>

Replica shards will never assign when you have a single node, it defeats the purpose of having both primary and replica shards on the same node.

---

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [March 22, 2016, 9:05am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/6 "2016-03-22T09:05:27Z")

</div>

So why is the status still red?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 22, 2016, 9:06am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/7 "2016-03-22T09:06:08Z")

</div>

Take a look at `_cat/shards`, you probably have an unassigned primary still.

---

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [March 22, 2016, 9:11am UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/8 "2016-03-22T09:11:00Z")

</div>

Only the kibana index (I don't know if its supposed to be so):

> .kibana 0 p UNASSIGNED  
> .kibana 0 r UNASSIGNED

This is the log;

> [2016-03-22 11:06:26,137][INFO][node] [Visimajoris] initialized  
> [2016-03-22 11:06:26,137][INFO][node] [Visimajoris] starting ...  
> [2016-03-22 11:06:26,363][INFO][transport] [Visimajoris] publish\_address {127.0.0.1:9300}, bound\_addresses {[::]:9300}  
> [2016-03-22 11:06:26,370][INFO][discovery] [Visimajoris] elasticsearch/HaBNtgVlSM-EbpHFbb8uhg  
> [2016-03-22 11:06:30,436][INFO][cluster.service] [Visimajoris] new\_master {Visimajoris}{HaBNtgVlSM-EbpHFbb8uhg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected\_as\_master, [0] joins received)  
> [2016-03-22 11:06:30,567][INFO][http] [Visimajoris] publish\_address {127.0.0.1:9200}, bound\_addresses {[::]:9200}  
> [2016-03-22 11:06:30,568][INFO][node] [Visimajoris] started  
> [2016-03-22 11:06:30,630][INFO][gateway] [Visimajoris] recovered [11] indices into cluster\_state

---

<div class="post-metadata">

**Author:** ![iliasse](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@iliasse](https://discuss.elastic.co/u/iliasse)\
**Post date:** [March 22, 2016, 2:12pm UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/9 "2016-03-22T14:12:10Z")

</div>

I think that you should update your cluster settings by setting the replicas to 0 :

```
PUT /_settings
    {
        "index" : {
            "number_of_replicas" : 0
        }
    }

```

This should solve the problem.  
make sure also that you did not disable automatic shard allocation in your yml  
cluster.routing.allocation.enable  
more here : [https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html)

---

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [March 22, 2016, 2:40pm UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/10 "2016-03-22T14:40:40Z")

</div>

Thanks everyone for your answers! after disabling the replicas and deleting the kibana index it worked.

Much appreciated!

---

<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 5, 2017, 11:06pm UTC](https://discuss.elastic.co/t/all-of-my-shards-suddenly-unassigned/45064/11 "2017-07-05T23:06:15Z")

</div>


