Replica Shards allocation in nodes


(Julian Somoza) #1

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...

All the indices have yellow state...

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

Thanks in advance!


(Ed) #2

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


(Julian Somoza) #3

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!


(Ed) #4

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.

#!/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

(Julian Somoza) #5

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


(system) #6