# Allocating shards and replicas

**URL:** <https://discuss.elastic.co/t/allocating-shards-and-replicas/5886>\
**Category:** Elasticsearch\
**Created:** [November 16, 2011, 1:01pm UTC](https://discuss.elastic.co/t/allocating-shards-and-replicas/5886 "2011-11-16T13:01:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [November 16, 2011, 1:01pm UTC](https://discuss.elastic.co/t/allocating-shards-and-replicas/5886/1 "2011-11-16T13:01:53Z")

</div>

Hi,

When I create index with two shards and one replica,we have two  
primary shards(assigned) and two unassigned replicas.  
If I add the another node to the cluster,How can I distribute one  
primary shard of first node to primary shard of second node and both  
have replicas of other node's primary shards?  
(With default settings it is assigning two replicas two second node)

Thanks,  
Kalyan

---

<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:** [November 16, 2011, 2:31pm UTC](https://discuss.elastic.co/t/allocating-shards-and-replicas/5886/2 "2011-11-16T14:31:31Z")

</div>

There isn't really a meaning to have primary shards evenly distributed.  
Indexing goes to the primary shard and the replica, and searches can  
execute on both.

On Wed, Nov 16, 2011 at 3:01 PM, kalyan [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com) wrote:

> Hi,
> 
> When I create index with two shards and one replica,we have two  
> primary shards(assigned) and two unassigned replicas.  
> If I add the another node to the cluster,How can I distribute one  
> primary shard of first node to primary shard of second node and both  
> have replicas of other node's primary shards?  
> (With default settings it is assigning two replicas two second node)
> 
> Thanks,  
> Kalyan

---

<div class="post-metadata">

**Author:** ![avinash\_nalluri](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@avinash\_nalluri](https://discuss.elastic.co/u/avinash_nalluri)\
**Post date:** [November 16, 2011, 4:53pm UTC](https://discuss.elastic.co/t/allocating-shards-and-replicas/5886/3 "2011-11-16T16:53:02Z")

</div>

When I have two nodes running,created index with two shards and one replica  
then node one has one primary shard and replica of second node's primary  
shard.The second node also has one primary shard and replica of the first  
node's primary shard.  
If I restart one node then primary shards are allocating on the single node  
only and both replicas are creating on another node.But even after  
restarting also it has to distribute like what happened previously.  
How to achieve this?

On Wed, Nov 16, 2011 at 8:01 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> There isn't really a meaning to have primary shards evenly distributed.  
> Indexing goes to the primary shard and the replica, and searches can  
> execute on both.
> 
> On Wed, Nov 16, 2011 at 3:01 PM, kalyan [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com) wrote:
> 
> > Hi,
> > 
> > When I create index with two shards and one replica,we have two  
> > primary shards(assigned) and two unassigned replicas.  
> > If I add the another node to the cluster,How can I distribute one  
> > primary shard of first node to primary shard of second node and both  
> > have replicas of other node's primary shards?  
> > (With default settings it is assigning two replicas two second node)
> > 
> > Thanks,  
> > Kalyan

---

<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:48am UTC](https://discuss.elastic.co/t/allocating-shards-and-replicas/5886/4 "2017-07-06T03:48:25Z")

</div>


