# Shards getting relocated after an upgrade

**URL:** https://discuss.elastic.co/t/shards-getting-relocated-after-an-upgrade/13761
**Category:** Elasticsearch
**Created:** [September 26, 2013, 6:28am UTC](https://discuss.elastic.co/t/shards-getting-relocated-after-an-upgrade/13761 "2013-09-26T06:28:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discuss.elastic.co/u/shadyabhi)
#### Post date: [September 26, 2013, 6:28am UTC](https://discuss.elastic.co/t/shards-getting-relocated-after-an-upgrade/13761/1 "2013-09-26T06:28:56Z")

</div>

Hi all,

I recently upgraded from elasticsearch-0.90.0-1 to elasticsearch-0.90.5.  
I've a 2 node cluster with all indices (total of 7) consisting of only  
2 shards. So, at all times, for a index, only 1 shards remain on the  
node.

After a restart, I expected the cluster to get back to life in few  
minutes but the shards started to relocate. That means, the shard that  
was earlier present on Node2 started to move to Node1. Isn't this  
unnecessary? For now, for a index, one of the shards is relocating and  
the other one is unassigned. See the following screenshot to see the  
status. [http://i.imgur.com/UILwjmA.png](http://i.imgur.com/UILwjmA.png)

Any reason why its happening? What can I do to avoid this? It takes a  
lot of time as it's network IO bound.

Thanks.

--  
Regards,  
Abhijeet Rastogi (shadyabhi)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discuss.elastic.co/u/shadyabhi)
#### Post date: [September 26, 2013, 6:40am UTC](https://discuss.elastic.co/t/shards-getting-relocated-after-an-upgrade/13761/2 "2013-09-26T06:40:20Z")

</div>

Oh, I think I found the reason. I did the cluster restart by "service  
elasticsearch restart" on the 2 nodes.

What I should have done was  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/).

Can someone confirm that this might be the issue?

On Thu, Sep 26, 2013 at 11:58 AM, Abhijeet Rastogi  
[abhijeet.1989@gmail.com](mailto:abhijeet.1989@gmail.com) wrote:

> Hi all,
> 
> I recently upgraded from elasticsearch-0.90.0-1 to elasticsearch-0.90.5.  
> I've a 2 node cluster with all indices (total of 7) consisting of only  
> 2 shards. So, at all times, for a index, only 1 shards remain on the  
> node.
> 
> After a restart, I expected the cluster to get back to life in few  
> minutes but the shards started to relocate. That means, the shard that  
> was earlier present on Node2 started to move to Node1. Isn't this  
> unnecessary? For now, for a index, one of the shards is relocating and  
> the other one is unassigned. See the following screenshot to see the  
> status. [http://i.imgur.com/UILwjmA.png](http://i.imgur.com/UILwjmA.png)
> 
> Any reason why its happening? What can I do to avoid this? It takes a  
> lot of time as it's network IO bound.
> 
> Thanks.
> 
> --  
> Regards,  
> Abhijeet Rastogi (shadyabhi)

--  
Regards,  
Abhijeet Rastogi (shadyabhi)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)
#### Post date: [October 4, 2013, 2:59pm UTC](https://discuss.elastic.co/t/shards-getting-relocated-after-an-upgrade/13761/3 "2013-10-04T14:59:55Z")

</div>

Hi,  
if you do short maintenance on a node, for instance upgrading, you indeed  
don't want relocation to happen. You can then temporarily disable  
allocation through the cluster settings api:

curl -XPUT localhost:9200/\_cluster/settings -d '{  
"transient" : {  
"cluster.routing.allocation.disable\_allocation" : true  
}  
}'

Don't forget to put it back on once you are done with your maintenance  
though:

curl -XPUT localhost:9200/\_cluster/settings -d '{  
"transient" : {  
"cluster.routing.allocation.disable\_allocation" : false  
}  
}'

Also, not related to your problem but it's best practice to issue a flush  
right before shutting down each node.

Cheers  
Luca

On Thursday, September 26, 2013 8:28:56 AM UTC+2, Abhijeet Rastogi wrote:

> Hi all,
> 
> I recently upgraded from elasticsearch-0.90.0-1 to elasticsearch-0.90.5.  
> I've a 2 node cluster with all indices (total of 7) consisting of only  
> 2 shards. So, at all times, for a index, only 1 shards remain on the  
> node.
> 
> After a restart, I expected the cluster to get back to life in few  
> minutes but the shards started to relocate. That means, the shard that  
> was earlier present on Node2 started to move to Node1. Isn't this  
> unnecessary? For now, for a index, one of the shards is relocating and  
> the other one is unassigned. See the following screenshot to see the  
> status. [http://i.imgur.com/UILwjmA.png](http://i.imgur.com/UILwjmA.png)
> 
> Any reason why its happening? What can I do to avoid this? It takes a  
> lot of time as it's network IO bound.
> 
> Thanks.
> 
> --  
> Regards,  
> Abhijeet Rastogi (shadyabhi)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:13am UTC](https://discuss.elastic.co/t/shards-getting-relocated-after-an-upgrade/13761/4 "2017-07-06T02:13:46Z")

</div>


