0
votes

I'm trying to make the health of my cluster green. According to the following elasticsearch documentation: When you add more nodes to a cluster, it automatically allocates replica shards. When all primary and replica shards are active, the cluster state changes to green.

source: https://www.elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html

So I created 2 elasticsearch instances with the following configuration files:

# Config File 1
cluster.name : PL
node.name : "Node-1"
node.master : true
node.data : true
network.host : "127.0.0.1"
http.port : 9200
discovery.zen.ping.unicast.hosts : ["127.0.0.1:9200", "127.0.0.1:9201"]
discovery.zen.minimum_master_nodes : 2

# Config File 2
cluster.name : PL
node.name : "Node-2"
node.master : true
node.data : true
network.host : "127.0.0.1"
http.port : 9201
discovery.zen.ping.unicast.hosts : ["127.0.0.1:9200", "127.0.0.1:9201"]
discovery.zen.minimum_master_nodes : 2

By running the following curl command : curl -GETX localhost:9200/_cluster/health?pretty=true I should according the elasticsearch documentation (see link below) have 2 nodes on my cluster. However, my number of nodes remains at 1.

source: https://www.elastic.co/guide/en/elasticsearch/guide/current/_add_failover.html

1
Can you add the logs from each node when you start them?Val
Sure I'm kinda new to stack overflow so would you rather have me edit my post and put them or would it be better suited if I uploaded them and share the link with you?Lok Ridgmont
If you can put them in your post, that's fine (should not be too long I guess) otherwise just gist them and provide the link.Val

1 Answers

1
votes

First of all, the port you're using in the discovery.zen.ping.unicast.hosts setting is not the correct one, it should be the TCP port, not the HTTP one.

However, since you're running on ES7, a new discovery protocol is now being used, which ignores the discovery.zen.ping.unicast.hosts setting.

Since you're running both nodes on the same machine, you don't need any special configuration to have both nodes form a cluster, they should auto-discover themselves (provided you remove the discovery.* settings.

If you're running the two nodes on two different machines, then you need to use the following settings instead:

discovery.seed_hosts:
   - 127.0.0.1:9300
   - 127.0.0.1:9301
cluster.initial_master_nodes:
   - 127.0.0.1:9300
   - 127.0.0.1:9301