# Replica Shards allocation in nodes

**URL:** <https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384>\
**Category:** Elasticsearch\
**Created:** [October 16, 2015, 12:47pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384 "2015-10-16T12:47:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zokratez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zokratez/32/5974_2.png) [@zokratez](https://discuss.elastic.co/u/zokratez)\
**Post date:** [October 16, 2015, 12:47pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384/1 "2015-10-16T12:47:53Z")

</div>

Hi!

I have 2 nodes:

Node 1

> cluster.name: elasticsearch  
> node.name: "belerian"  
> node.master: true  
> node.data: true  
> discovery.zen.ping.multicast.enabled: false  
> discovery.zen.ping.unicast.hosts: ["gondolin.cabib.local"]

Node 2

> cluster.name: elasticsearch  
> node.name: "gondolin"  
> node.master: false  
> node.data: true  
> discovery.zen.ping.multicast.enabled: false  
> discovery.zen.ping.unicast.hosts: ["belerian.cabib.local"]

The problem is that the status is Yellow...  
**xxx.xxx.xxx.xxx:9200/\_cat/health**

> 1444988073 04:34:33 elasticsearch yellow 3 2 45 45 0 0 45

And the nodes are there... **xxx.xxx.xxx.xxx:9200/\_cat/nodes**

> belerian 127.0.0.1 27 20 3.60 d \* belerian  
> belerian 127.0.0.1 36 c - logstash-belerian-1799-11646  
> gondolin 127.0.0.1 7 23 0.01 d - gondolin

If I check allocation with api... **xxx.xxx.xxx.xxx:9200/\_cat/allocation**

> 45 26.1gb 48.6gb 74.7gb 34 belerian 127.0.0.1 belerian  
> 0 0b belerian 127.0.0.1 logstash-belerian-1799-11646  
> 0 10.6gb 34.9gb 45.5gb 23 gondolin 127.0.0.1 gondolin  
> 45 UNASSIGNED

The node dont appear in Marvel plugin...

 ![](https://us1.discourse-cdn.com/elastic/original/2X/7/7f1e622979c0189b6cb1469989674b21a4f7d575.png)

All the indices have yellow state...

 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/6308bd77038b2319f18113643c02db42eaf08fc3.png)

What's my mistake? What can I do to send replicas to the other nodes?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [October 16, 2015, 1:15pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384/2 "2015-10-16T13:15:07Z")

</div>

Since you disabled multicast you need to list both hosts in your server list. That is the fist thing I see that might influence the second node from appearing And if you have replication on with no second node there is no place for the replicas to go, hence yellow

See if that helps, I'll look more too at the details you gave

---

<div class="post-metadata">

**Author:** ![zokratez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zokratez/32/5974_2.png) [@zokratez](https://discuss.elastic.co/u/zokratez)\
**Post date:** [October 16, 2015, 1:41pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384/3 "2015-10-16T13:41:58Z")

</div>

Thanks for your help!

I turn to true the option discovery.zen.ping.multicast.enabled but 45 shards still unallocated...

I will continue reading out while I wait some help.

Thanks!

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [October 16, 2015, 3:26pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384/4 "2015-10-16T15:26:45Z")

</div>

if you have two nodes and it is not working try this little script to re-allocated the unallocated shards

You have to update the SETYOURNODENAME in the script.

```auto
#!/bin/bash
#DEBUG enable next line
set -x
HOSTNAME="localhost"
PORT="9200"
#set #-x
curl -sk -XGET http://$HOSTNAME:$PORT/_cat/shards | grep UNASSIGNED | awk '{ print $1 " " $2 }'| while read ind shard
do
    echo " Moving $ind Shard $shard to YOURNODENAME"
    curl -ks -XPOST "$HOSTNAME:$PORT/_cluster/reroute" -d '{
        "commands" : [ {
              "allocate" : {
                  "index" : "'$ind'",
                  "shard" : '$shard',
                  "node" : "SETYOURNODENAME",
                  "allow_primary" : true
              }
            }
        ]
    }' > /dev/null
done
wait

```

---

<div class="post-metadata">

**Author:** ![zokratez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zokratez/32/5974_2.png) [@zokratez](https://discuss.elastic.co/u/zokratez)\
**Post date:** [October 16, 2015, 6:44pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384/5 "2015-10-16T18:44:12Z")

</div>

Changing that parameter to true make the diference! Thanks!!

---

<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, 11:44pm UTC](https://discuss.elastic.co/t/replica-shards-allocation-in-nodes/32384/6 "2017-07-05T23:44:18Z")

</div>


