# Balanced shards and replicas in ES

**URL:** <https://discuss.elastic.co/t/balanced-shards-and-replicas-in-es/8644>\
**Category:** Elasticsearch\
**Created:** [August 6, 2012, 9:41am UTC](https://discuss.elastic.co/t/balanced-shards-and-replicas-in-es/8644 "2012-08-06T09:41:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernd\_Fehling](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@Bernd\_Fehling](https://discuss.elastic.co/u/Bernd_Fehling)\
**Post date:** [August 6, 2012, 9:41am UTC](https://discuss.elastic.co/t/balanced-shards-and-replicas-in-es/8644/1 "2012-08-06T09:41:42Z")

</div>

After creating a new index with index.number\_of\_shards=2 and  
index.number\_of\_replicas=1 on a two node cluster everything is "well  
balanced" which means each node has one primary shard and one replica.  
Then node\_2 is going down, and both shards on node\_1 become primary.  
After that node\_2 comes up again but both shards on node\_1 stay on primary.

ES is not rebalancing/redistributing by itself ?

Am I missing any settings?

Do I have to send a command to the API?

Bernd

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 7, 2012, 9:46pm UTC](https://discuss.elastic.co/t/balanced-shards-and-replicas-in-es/8644/2 "2012-08-07T21:46:50Z")

</div>

Not really missing something, the fact that two primaries exist on a node and not balanced as in one primary per node does not really affect who things work since replication is sync (by default) and replicas also serve searches. Yet, there might be cases where you would want to make sure primaries are evened out (specifically in the future, when snapshotting/backup of local data is implemented), and then we will allow for at least an API to allow to even it out.

On Aug 6, 2012, at 11:41 AM, Bernd Fehling [bernd.fehling@googlemail.com](mailto:bernd.fehling@googlemail.com) wrote:

> After creating a new index with index.number\_of\_shards=2 and index.number\_of\_replicas=1 on a two node cluster everything is "well balanced" which means each node has one primary shard and one replica.  
> Then node\_2 is going down, and both shards on node\_1 become primary.  
> After that node\_2 comes up again but both shards on node\_1 stay on primary.
> 
> ES is not rebalancing/redistributing by itself ?
> 
> Am I missing any settings?
> 
> Do I have to send a command to the API?
> 
> Bernd

---

<div class="post-metadata">

**Author:** ![Bernd\_Fehling](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@Bernd\_Fehling](https://discuss.elastic.co/u/Bernd_Fehling)\
**Post date:** [August 8, 2012, 7:40am UTC](https://discuss.elastic.co/t/balanced-shards-and-replicas-in-es/8644/3 "2012-08-08T07:40:15Z")

</div>

Actually, if the systems are in state STARTED and all is "green", only the  
routing has to be switched (primary: true/false) between shards, or is this  
blue-eyed from my point of view?

Bernd

---

<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:17am UTC](https://discuss.elastic.co/t/balanced-shards-and-replicas-in-es/8644/4 "2017-07-06T03:17:17Z")

</div>


