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

4
  • Can you add the logs from each node when you start them? Commented May 3, 2019 at 6: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? Commented May 3, 2019 at 6: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. Commented May 3, 2019 at 6:15
  • Here it is: gist.github.com/GlamorCodius/58cb2d8e7e403d1c795fe12eaa9a43a7 Commented May 3, 2019 at 6:28

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.