# Balancing shards equally per nodes

**URL:** https://discuss.elastic.co/t/balancing-shards-equally-per-nodes/47297
**Category:** Elasticsearch
**Created:** [April 13, 2016, 6:29pm UTC](https://discuss.elastic.co/t/balancing-shards-equally-per-nodes/47297 "2016-04-13T18:29:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![oranciog](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@oranciog](https://discuss.elastic.co/u/oranciog)
#### Post date: [April 13, 2016, 6:29pm UTC](https://discuss.elastic.co/t/balancing-shards-equally-per-nodes/47297/1 "2016-04-13T18:29:29Z")

</div>

Hy,

I have a ES cluster running 1.6.0, consisting of 10 nodes.

2 of them are new nodes in this cluster, with small number of shards( hundreds).  
The other 8 nodes have thousands of shards.

The problem is that when a new index (I create indexes with 10 shards and 0 replicas), all shards from the newly index goes to those 2 nodes and I want to distribute equally in the cluster. (This means one shard/node).

I tried without luck the following settings:  
"persistent": {"cluster": {"routing": {"allocation": {"balance": {"index": "0.7","shard": "0.3"}}}}}  
"persistent": {"cluster": {"routing": {"allocation": {"balance": {"index": "0.8","shard": "0.2"}}}}}  
"persistent": {"cluster": {"routing": {"allocation": {"balance": {"index": "2","shard": "0.1"}}}}}

How can I do this?

Thank you,

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [April 13, 2016, 6:44pm UTC](https://discuss.elastic.co/t/balancing-shards-equally-per-nodes/47297/2 "2016-04-13T18:44:02Z")

</div>

Have a look at [https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-total-shards.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-total-shards.html)

Also, you should be better off with higher numbers for the `shard` setting. It sounds like the cluster hasn't fully balanced yet after the new nodes. Is that so?

Also, hundreds of shards is a lot. Like, thousands of shards is ok, but has significant overhead.

---

<div class="post-metadata">

### Author: ![oranciog](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@oranciog](https://discuss.elastic.co/u/oranciog)
#### Post date: [April 14, 2016, 8:57am UTC](https://discuss.elastic.co/t/balancing-shards-equally-per-nodes/47297/3 "2016-04-14T08:57:00Z")

</div>

Thanks Nik for your reply.

_index.routing.allocation.total\_shards\_per\_node_ can be set on each index or is a cluster variable?

Right now, it seems that with the following settings:

_"persistent": {"cluster": {"routing": {"allocation": {"balance": {"index": "10","shard": "0.1"}}}}},_

the shards of newly created indexes are distributed evenly.

---

<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 5, 2017, 10:59pm UTC](https://discuss.elastic.co/t/balancing-shards-equally-per-nodes/47297/4 "2017-07-05T22:59:22Z")

</div>


