# Shard Reallocation Priority

**URL:** <https://discuss.elastic.co/t/shard-reallocation-priority/82779>\
**Category:** Elasticsearch\
**Created:** [April 18, 2017, 8:44pm UTC](https://discuss.elastic.co/t/shard-reallocation-priority/82779 "2017-04-18T20:44:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinceh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinceh/32/17475_2.png) [@vinceh](https://discuss.elastic.co/u/vinceh)\
**Post date:** [April 18, 2017, 8:44pm UTC](https://discuss.elastic.co/t/shard-reallocation-priority/82779/1 "2017-04-18T20:44:03Z")

</div>

One of the beautiful things about elastic is it's automatic shard  
allocations. This is also something that is painful, when reallocating  
large amounts of data - at least from my (lack of) experience.

I have a cluster with 3 nodes. All indexes have replication set to one.  
Let's say I turn off a node, migrate it to a system with clean disks,  
bring it back online. What happens next is a bit of voodoo.

Presumably the two active nodes start replicating their shards to the clean node. That does indeed happen, however they also start cross replicating. So instead of both nodes reallocating to the node with the fewest shards, it seemingly tries to cross balance amongst the two with the most shards as well.

To visualize, elastic01 and elastic03 were the active nodes. Elastic02  
came up clean.

elastic01 -\> elastic02  
elastic01 -\> elastic03  
elastic03 -\> elastic02  
elastic03 -\> elastic01  
elastic03 -\> elastic01

elastic01 & elastic03 have about 400 shards each, but instead of them  
just sending some to elastic02, what I see is elastic trying to also  
balance the shards between elastic01 and elastic03, especially when the  
shard count between them starts to differ do to different sized shards.

I tried to set balance.threshold to 30 so they wouldn't cross balance,  
but that had no effect that I could discern.

Hopefully this isn't too convuluted to follow. How can we get elastic  
to prioritize the shard reallocation to the node with the fewest shards  
rather then clogging up the process with cross node replication?

Vince

---

<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:** [April 18, 2017, 11:06pm UTC](https://discuss.elastic.co/t/shard-reallocation-priority/82779/2 "2017-04-18T23:06:31Z")

</div>

What version are you on?

---

<div class="post-metadata">

**Author:** ![vinceh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinceh/32/17475_2.png) [@vinceh](https://discuss.elastic.co/u/vinceh)\
**Post date:** [April 19, 2017, 12:15am UTC](https://discuss.elastic.co/t/shard-reallocation-priority/82779/3 "2017-04-19T00:15:55Z")

</div>

This is Elastic 2.4.1.

---

<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:** [May 17, 2017, 12:26am UTC](https://discuss.elastic.co/t/shard-reallocation-priority/82779/4 "2017-05-17T00:26:27Z")

</div>

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