# Re-balancing shard allocation

**URL:** <https://discuss.elastic.co/t/re-balancing-shard-allocation/132726>\
**Category:** Elasticsearch\
**Created:** [May 22, 2018, 6:26am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726 "2018-05-22T06:26:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 6:26am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/1 "2018-05-22T06:26:37Z")

</div>

we have cluster with 100 node and our index name are base on date. with elastic default options, the situation is like this:

the shard of index that begin with 2017-June are in first 10 node  
the shard of index that begin with 2017-May are in second 10 node  
the shard of index that begin with 2017-April are in third 10 node  
and so on for every month.

the problem is workload on the 10 node that have last month index are very high and we want to distribute the shards and work load.

I think elastic have option for this situation: cluster.routing.allocation.balance.index cluster.routing.allocation.balance.shard with it get a float number.

Am I correct with this? how much i should raise the float number?

any explanation will be appreciate  
thanks.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 6:29am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/2 "2018-05-22T06:29:59Z")

</div>

How did you end up with that kind of distribution in the first place? I would expect Elasticsearch to spread it out quite evenly by default.

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 6:31am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/3 "2018-05-22T06:31:57Z")

</div>

I don't know. as I said, all setting are default and we didn't change any specific options.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 6:43am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/4 "2018-05-22T06:43:07Z")

</div>

How many shards do you have per node? Are you using daily indices?

Can you show the configuration for one of the nodes as well as the index settings for an index on that node?

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 6:56am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/5 "2018-05-22T06:56:07Z")

</div>

yes. we use daily indices.  
at least 100 shards per node.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 6:59am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/6 "2018-05-22T06:59:00Z")

</div>

That sounds like a very large number of potentially small shards, which can be very inefficient. Please read [this blog post](https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster) for some practical guidelines around sharding and shard sizes.

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 7:04am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/7 "2018-05-22T07:04:09Z")

</div>

no. the shards at least have 50 GB data and they are not small

thank you for responding but the problem is about how to distribute last month shards between 50% of nodes.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 7:06am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/8 "2018-05-22T07:06:28Z")

</div>

If your shards are at least 50GB in size and you have over 1000 shards per node, that means over 50TB of data per node, is that correct? Are all these indices open? Can you perhaps provide the output of the [cluster stats API](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-stats.html)?

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 7:11am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/9 "2018-05-22T07:11:19Z")

</div>

sorry. I did a mistake. 100 shards per node.  
yes we have 5 TB per node.

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 7:12am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/10 "2018-05-22T07:12:16Z")

</div>

I cant send you cluster stats now.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 7:13am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/11 "2018-05-22T07:13:29Z")

</div>

Then it sounds like you are following best practices. 🙂

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 7:15am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/12 "2018-05-22T07:15:19Z")

</div>

can you describe cluster.routing.allocation.balance.shard option?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 7:19am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/13 "2018-05-22T07:19:11Z")

</div>

How many shards do you have per index? How large portion of indices related to June 2017 are located on this set of 10 nodes? Is there more than 1 shard for any particular index on any one node?

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 7:25am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/14 "2018-05-22T07:25:04Z")

</div>

between 5 to 10 shards according to indices.  
no. there is not more than 1 shard of a index on any node.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2018, 7:39am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/15 "2018-05-22T07:39:52Z")

</div>

Then those settings may not help much as they look to distribute shards of individual indices across nodes. You may need to [manually reroute](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-reroute.html) indices.

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 7:43am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/16 "2018-05-22T07:43:10Z")

</div>

thanks for the answers.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 22, 2018, 9:27am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/17 "2018-05-22T09:27:18Z")

</div>

How many indices per month are being created?

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 22, 2018, 11:18am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/19 "2018-05-22T11:18:03Z")

</div>

60 indices.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 22, 2018, 12:31pm UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/20 "2018-05-22T12:31:34Z")

</div>

Wild guess: are you perhaps deleting some "old" indices just before creating the new ones each month? If so, Elasticsearch may be preferring to put the new shards where the old ones have left gaps, and if the old indices were all concentrated on 10 nodes then the new ones will be too.

If it is this, then creating the new indices **without** first deleting the old ones should cause them to be allocated more evenly.

---

<div class="post-metadata">

**Author:** ![hamid\_bayat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid_bayat/32/74056_2.png) [@hamid\_bayat](https://discuss.elastic.co/u/hamid_bayat)\
**Post date:** [May 23, 2018, 6:11am UTC](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726/21 "2018-05-23T06:11:02Z")

</div>

> [@DavidTurner](#):
>
> the new indices **without** first dele

thanks for responds.  
we don't delete any index.

[Next page](https://discuss.elastic.co/t/re-balancing-shard-allocation/132726.md?page=2)
