# When will Master Node push replica to new join data node?

**URL:** <https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207>\
**Category:** Elasticsearch\
**Created:** [September 22, 2016, 6:59am UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207 "2016-09-22T06:59:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![itplayer](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@itplayer](https://discuss.elastic.co/u/itplayer)\
**Post date:** [September 22, 2016, 6:59am UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207/1 "2016-09-22T06:59:34Z")

</div>

Hi I'd like to know the whole process of primary shard & replica shard actual interaction process.  
I have a single node and setting with 2 shards & 1 replica. When I start to index document,

1. since there is only one node (it is mater node), where does replica shard exist?

2. if a new node join as data node, does master node knows and when push shard to new node as replica?

I trace the source code (1.7.2) and I can see primaryPhase and replicaPhase. but if I have only one node, seems nothing happended on replica.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 22, 2016, 7:18am UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207/2 "2016-09-22T07:18:45Z")

</div>

> since there is only one node (it is mater node), where does replica shard exist?

Nowhere. ES refuses to allocate a replica shard on the same node as the primary shard. It's therefore useful to try to have replicas in a single-node cluster.

---

<div class="post-metadata">

**Author:** ![itplayer](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@itplayer](https://discuss.elastic.co/u/itplayer)\
**Post date:** [September 22, 2016, 7:29am UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207/3 "2016-09-22T07:29:20Z")

</div>

@magnusbaeck thank.  
But what if later I setup a new node to join?  
Will master start to replicate data to new node(with all indexed docs before new node join) or stat to allocate replica from new node join?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 22, 2016, 7:59am UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207/4 "2016-09-22T07:59:11Z")

</div>

Replica shards will always be in sync with the primary shards.

---

<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:** [September 22, 2016, 10:23am UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207/5 "2016-09-22T10:23:06Z")

</div>

When the new node joins ES will try and allocate unallocated shard copies  
to it. That means if you have a single node cluster and you make an index  
with `number_of_replicas: 1` and you add another node, then that other node  
will get a second copy of everything on the first node.

---

<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:18pm UTC](https://discuss.elastic.co/t/when-will-master-node-push-replica-to-new-join-data-node/61207/6 "2017-07-05T22:18:12Z")

</div>


