# Question on Replica

**URL:** https://discuss.elastic.co/t/question-on-replica/8638
**Category:** Elasticsearch
**Created:** [August 5, 2012, 11:35am UTC](https://discuss.elastic.co/t/question-on-replica/8638 "2012-08-05T11:35:35Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Rahul\_Sharma](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@Rahul\_Sharma](https://discuss.elastic.co/u/Rahul_Sharma)
#### Post date: [August 5, 2012, 11:35am UTC](https://discuss.elastic.co/t/question-on-replica/8638/1 "2012-08-05T11:35:35Z")

</div>

Hi,

I have a Question on replica settings. Would appreciate your help on this.

1. I was having one node of ES where initially; it was with default setup  
which is 5 shards and 1 replica.
2. Then I wanted to increase the node to 2.
3. Before adding another node I stopped the running node. Edited the  
elasticsearch.yml and changed the replica number to 0.
4. Then I started both the nodes. (Both the nodes has same elasticsearch  
config parameters especially on number of shards and replica)
5. Now I expect the shards to get distributed among both the nodes.

But the second node replicated entire indices and shards and became more  
like a replica.

Is there anything I am doing wrong?

Thanks  
Rahul

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [August 5, 2012, 11:43am UTC](https://discuss.elastic.co/t/question-on-replica/8638/2 "2012-08-05T11:43:05Z")

</div>

> 1. Before adding another node I stopped the running node. Edited the  
> elasticsearch.yml and changed the replica number to 0.

The config just acts as a template for new indices. Changing the config  
doesn't affect any indices that already exist.

To do that, you should use the index settings API.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

clint

---

<div class="post-metadata">

### Author: ![Rahul\_Sharma](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@Rahul\_Sharma](https://discuss.elastic.co/u/Rahul_Sharma)
#### Post date: [August 5, 2012, 12:03pm UTC](https://discuss.elastic.co/t/question-on-replica/8638/3 "2012-08-05T12:03:22Z")

</div>

That was it!!  
Thanks a lot Clint. Appreciate your quick response.

On Sun, Aug 5, 2012 at 5:13 PM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)wrote:

> > 1. Before adding another node I stopped the running node. Edited the  
> > elasticsearch.yml and changed the replica number to 0.
> 
> The config just acts as a template for new indices. Changing the config  
> doesn't affect any indices that already exist.
> 
> To do that, you should use the index settings API.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)
> 
> clint

---

<div class="post-metadata">

### Author: ![Rahul\_Sharma](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@Rahul\_Sharma](https://discuss.elastic.co/u/Rahul_Sharma)
#### Post date: [August 5, 2012, 12:20pm UTC](https://discuss.elastic.co/t/question-on-replica/8638/4 "2012-08-05T12:20:29Z")

</div>

What I notice is that while re-balancing the nodes are re balancing the  
indices not the shards within it?  
I was expecting the shards to get rebalanced.  
Now Index 1 has all the shards in Node 1, whereas Index 2 has all the 5  
shards in Node 2.

Is this an expected behavior?

Thanks  
Rahul

On Sun, Aug 5, 2012 at 5:33 PM, Rahul Sharma  
[rahul.sharma.coder@gmail.com](mailto:rahul.sharma.coder@gmail.com)wrote:

> That was it!!  
> Thanks a lot Clint. Appreciate your quick response.
> 
> On Sun, Aug 5, 2012 at 5:13 PM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)wrote:
> 
> > > 1. Before adding another node I stopped the running node. Edited the  
> > > elasticsearch.yml and changed the replica number to 0.
> > 
> > The config just acts as a template for new indices. Changing the config  
> > doesn't affect any indices that already exist.
> > 
> > To do that, you should use the index settings API.
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)
> > 
> > clint

---

<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:56pm UTC](https://discuss.elastic.co/t/question-on-replica/8638/5 "2012-08-07T21:56:55Z")

</div>

Shards are being evened out, index is not really taken into account (and thats the problem you are running into). Thats how ES works now, and you can work a bit around it by shards\_per\_node setting. It will be improved in the very near future.

On Aug 5, 2012, at 2:20 PM, Rahul Sharma [rahul.sharma.coder@gmail.com](mailto:rahul.sharma.coder@gmail.com) wrote:

> What I notice is that while re-balancing the nodes are re balancing the indices not the shards within it?  
> I was expecting the shards to get rebalanced.  
> Now Index 1 has all the shards in Node 1, whereas Index 2 has all the 5 shards in Node 2.
> 
> Is this an expected behavior?
> 
> Thanks  
> Rahul
> 
> On Sun, Aug 5, 2012 at 5:33 PM, Rahul Sharma [rahul.sharma.coder@gmail.com](mailto:rahul.sharma.coder@gmail.com) wrote:  
> That was it!!  
> Thanks a lot Clint. Appreciate your quick response.
> 
> On Sun, Aug 5, 2012 at 5:13 PM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com) wrote:
> 
> > 1. Before adding another node I stopped the running node. Edited the  
> > elasticsearch.yml and changed the replica number to 0.
> 
> The config just acts as a template for new indices. Changing the config  
> doesn't affect any indices that already exist.
> 
> To do that, you should use the index settings API.  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)
> 
> clint

---

<div class="post-metadata">

### Author: ![Rahul\_Sharma](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@Rahul\_Sharma](https://discuss.elastic.co/u/Rahul_Sharma)
#### Post date: [August 7, 2012, 10:13pm UTC](https://discuss.elastic.co/t/question-on-replica/8638/6 "2012-08-07T22:13:03Z")

</div>

Aah I see.  
Just FYI, Indexes created afterwards got distributed correctly.

On Wed, Aug 8, 2012 at 3:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Shards are being evened out, index is not really taken into account (and  
> thats the problem you are running into). Thats how ES works now, and you  
> can work a bit around it by shards\_per\_node setting. It will be improved in  
> the very near future.
> 
> On Aug 5, 2012, at 2:20 PM, Rahul Sharma [rahul.sharma.coder@gmail.com](mailto:rahul.sharma.coder@gmail.com)  
> wrote:
> 
> What I notice is that while re-balancing the nodes are re balancing the  
> indices not the shards within it?  
> I was expecting the shards to get rebalanced.  
> Now Index 1 has all the shards in Node 1, whereas Index 2 has all the 5  
> shards in Node 2.
> 
> Is this an expected behavior?
> 
> Thanks  
> Rahul
> 
> On Sun, Aug 5, 2012 at 5:33 PM, Rahul Sharma \<[rahul.sharma.coder@gmail.com](mailto:rahul.sharma.coder@gmail.com)
> 
> > wrote:
> 
> > That was it!!  
> > Thanks a lot Clint. Appreciate your quick response.
> > 
> > On Sun, Aug 5, 2012 at 5:13 PM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)wrote:
> > 
> > > > 1. Before adding another node I stopped the running node. Edited the  
> > > > elasticsearch.yml and changed the replica number to 0.
> > > 
> > > The config just acts as a template for new indices. Changing the config  
> > > doesn't affect any indices that already exist.
> > > 
> > > To do that, you should use the index settings API.
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)
> > > 
> > > clint

---

<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/question-on-replica/8638/7 "2017-07-06T03:17:24Z")

</div>


