# How do I relocate shards from a node prior to shutting it down?

**URL:** <https://discuss.elastic.co/t/how-do-i-relocate-shards-from-a-node-prior-to-shutting-it-down/9492>\
**Category:** Elasticsearch\
**Created:** [October 29, 2012, 11:55am UTC](https://discuss.elastic.co/t/how-do-i-relocate-shards-from-a-node-prior-to-shutting-it-down/9492 "2012-10-29T11:55:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piavlo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/piavlo/32/1214_2.png) [@Piavlo](https://discuss.elastic.co/u/Piavlo)\
**Post date:** [October 29, 2012, 11:55am UTC](https://discuss.elastic.co/t/how-do-i-relocate-shards-from-a-node-prior-to-shutting-it-down/9492/1 "2012-10-29T11:55:36Z")

</div>

Is it possible to relocate shards from a node before a shutdown  
Does nodes shutdown api do shards relocation prior to shutting down?  
[http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html)

tnx

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [October 29, 2012, 6:28pm UTC](https://discuss.elastic.co/t/how-do-i-relocate-shards-from-a-node-prior-to-shutting-it-down/9492/2 "2012-10-29T18:28:42Z")

</div>

The \_shutdown API doesn't relocate shards automatically. In a typical  
scenario with at least one replica for each shard, you can simply shutdown  
a node and elasticsearch will automatically allocate new shards to preserve  
correct number of replicas. However, you can do it manually by updating  
"cluster.routing.allocation.exclude.\*" settings using Cluster Update  
Settings API[http://www.elasticsearch.org/guide/reference/api/admin-cluster-update-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-cluster-update-settings.html).  
For example, if you want to shutdown a node with id  
"IdQx48TwSE-e5PI1cV-kOA", you can execute the following command prior to  
shutdown:

curl -XPUT localhost:9200/\_cluster/settings -d '{"transient":  
{"cluster.routing.allocation.exclude.\_id" :"IdQx48TwSE-e5PI1cV-kOA"}}'

wait until all shards are gone from this node, and then shutdown the node.  
See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html) for  
more information.

On Monday, October 29, 2012 7:55:43 AM UTC-4, Piavlo wrote:

> Is it possible to relocate shards from a node before a shutdown  
> Does nodes shutdown api do shards relocation prior to shutting down?
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html)
> 
> tnx

--

---

<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, 3:06am UTC](https://discuss.elastic.co/t/how-do-i-relocate-shards-from-a-node-prior-to-shutting-it-down/9492/3 "2017-07-06T03:06:54Z")

</div>


