# Preventing re-allocation of shards

**URL:** <https://discuss.elastic.co/t/preventing-re-allocation-of-shards/12933>\
**Category:** Elasticsearch\
**Created:** [July 25, 2013, 9:04am UTC](https://discuss.elastic.co/t/preventing-re-allocation-of-shards/12933 "2013-07-25T09:04:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tim_s/32/958_2.png) [@Tim\_S](https://discuss.elastic.co/u/Tim_S)\
**Post date:** [July 25, 2013, 9:04am UTC](https://discuss.elastic.co/t/preventing-re-allocation-of-shards/12933/1 "2013-07-25T09:04:51Z")

</div>

When I create an index, shards and replicas are allocated evenly across my  
nodes. But if one of my nodes dies, its shards get reallocated to other  
nodes in the cluster. Then, when it comes back up it gets allocated some  
shards again, BUT not necessarily the ones it had to start with. This means  
if I restart a particular server, when it comes back up it's going to spend  
x amount of time downloading the index from another node. If it was only  
down for 30 seconds and no documents were indexed in that time its lucene  
index would still be perfectly valid, but we seem to throw it away. It just  
seems like a waste of time to transfer the index (potentially 10s of Gb?)  
even if it has a valid copy of the index?

I know I can use the cluster.routing.allocation.disable\_\*allocation  
settings to stop it doing any auto allocation, but then it does not do any  
allocation for a new index. Which means when creating a new index, I would  
have to do the allocation manually.

What I would like is a way of having elastic search do the allocation on  
creation of a new index, but after that leave everything alone. Is this  
possible, or am I just thinking about this in totally the wrong way?

Thanks.

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 26, 2013, 3:29pm UTC](https://discuss.elastic.co/t/preventing-re-allocation-of-shards/12933/2 "2013-07-26T15:29:00Z")

</div>

Disabling allocation is my usual route, but as you stated, it might not  
work for everybody. You can try excluding that server.

> **[ElasticSearch Shard Placement Control - Sematext](https://sematext.com/blog/elasticsearch-shard-placement-control/)**
>
> In this post you will learn how to control ElasticSearch shard placement.  If you are coming to our ElasticSearch talk at BerlinBuzzwords, we’ll be talking about this and more. If you’ve ever used ElasticSearch you probably know that you can set...

If you are not indexing during your planned restarts, I find it helpful to  
flush the replication logs. Another option is to increase your timeout  
during your planned outages.

Cheers,

Ivan

On Thu, Jul 25, 2013 at 2:04 AM, Tim S [timstibbs@gmail.com](mailto:timstibbs@gmail.com) wrote:

> When I create an index, shards and replicas are allocated evenly across my  
> nodes. But if one of my nodes dies, its shards get reallocated to other  
> nodes in the cluster. Then, when it comes back up it gets allocated some  
> shards again, BUT not necessarily the ones it had to start with. This means  
> if I restart a particular server, when it comes back up it's going to spend  
> x amount of time downloading the index from another node. If it was only  
> down for 30 seconds and no documents were indexed in that time its lucene  
> index would still be perfectly valid, but we seem to throw it away. It just  
> seems like a waste of time to transfer the index (potentially 10s of Gb?)  
> even if it has a valid copy of the index?
> 
> I know I can use the cluster.routing.allocation.disable\_\*allocation  
> settings to stop it doing any auto allocation, but then it does not do any  
> allocation for a new index. Which means when creating a new index, I would  
> have to do the allocation manually.
> 
> What I would like is a way of having Elasticsearch do the allocation on  
> creation of a new index, but after that leave everything alone. Is this  
> possible, or am I just thinking about this in totally the wrong way?
> 
> Thanks.
> 
> --  
> 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).

--  
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:24am UTC](https://discuss.elastic.co/t/preventing-re-allocation-of-shards/12933/3 "2017-07-06T02:24:17Z")

</div>


