0

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

Lok Ridgmont
  • 113
  • 1
  • 9
  • Can you add the logs from each node when you start them? – Val May 03 '19 at 06:08
  • 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 May 03 '19 at 06:11
  • 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 May 03 '19 at 06:15
  • Here it is: https://gist.github.com/GlamorCodius/58cb2d8e7e403d1c795fe12eaa9a43a7 – Lok Ridgmont May 03 '19 at 06:28

1 Answers1

1

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
Val
  • 207,596
  • 13
  • 358
  • 360
  • I removed the `discovery.*` settings as you advised me. However, it didn't seem to work, the `curl` command kept showing me that the number of nodes is equal to 1. I therefore tried the other solution that you provided (even though I'm on the same machine) and the result didn't seem to change. – Lok Ridgmont May 03 '19 at 06:52
  • So After doing what you suggested, I had a warning telling me that replication was not possible due to the fact that `low disk watermark [??%] exceeded on`. I therefor corrected it with the following settings: `cluster.routing.allocation.disk.threshold_enabled: true cluster.routing.allocation.disk.watermark.flood_stage: 5gb cluster.routing.allocation.disk.watermark.low: 30gb cluster.routing.allocation.disk.watermark.high: 20gb` Now the error is gone but sadly the number of nodes on the cluster remains at 1. – Lok Ridgmont May 03 '19 at 07:25