Discovery.zen.ping.unicast.hosts in elasticsearch.yml


(vijayakrishna Gade) #1

Hi,

I have totally 4 nodes running under my Azure scaleset, all 4 machines can be talk to each other.

it means pingable each other and telnet using port 22 and 9200 each other.

installed elasticsearch 6.x on all the 4 machines, and also updated elasticsearch.yml with below information on all 4 nodes.

node1

cluster.name: myescluster
node.name: node1
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["10.0.0.1", "10.0.0.2", "10.0.0.3", "10.0.0.4"]
node.master: true
transport.tcp.port: 9300-9400
http.port: 9200

node2

cluster.name: myescluster
node.name: node2
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["10.0.0.1", "10.0.0.2", "10.0.0.3", "10.0.0.4"]
node.master: true
transport.tcp.port: 9300-9400
http.port: 9200

node3

cluster.name: myescluster
node.name: node3
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["10.0.0.1", "10.0.0.2", "10.0.0.3", "10.0.0.4"]
node.data: true
transport.tcp.port: 9300-9400
http.port: 9200

node4

cluster.name: myescluster
node.name: node4
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["10.0.0.1", "10.0.0.2", "10.0.0.3", "10.0.0.4"]
node.data: true
transport.tcp.port: 9300-9400
http.port: 9200

When i run curl command to list nodes under cluster "curl -XGET http://localhost:9200/_cat/nodes?v"

it's showing only the self node where am running curl command.

[root@node1 elasticsearch]# curl -XGET http://localhost:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10.0.0.1 29 45 1 0.02 0.08 0.11 mdi * node1

if i run on node2

[root@node2 elasticsearch]# curl -XGET http://localhost:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10.0.0.2 29 45 1 0.02 0.08 0.11 mdi * node2

[root@node3 elasticsearch]# curl -XGET http://localhost:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10.0.0.3 29 45 1 0.02 0.08 0.11 mdi * node3

[root@node4 elasticsearch]# curl -XGET http://localhost:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10.0.0.4 29 45 1 0.02 0.08 0.11 mdi * node4

Cluster health:

[root@node1 elasticsearch]# curl -XGET "http://localhost:9200/_cluster/health"
{"cluster_name":"myescluster","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0}

Please suggest if am missing anything, Thanks.


(Christian Dahlqvist) #2

Elasticsearch nodes communicate internally via the 9300 port by default, so you need to make sure this is not blocked.


(vijayakrishna Gade) #3

i can do telnet to other machines using port 9200 and 9300, both are enabled on all 4 machines


(Christian Dahlqvist) #4

One setting I do not see is discovery.zen.minimum_master_nodes, which in your case should be set to 3 as you have 4 master-eligible nodes. As the nodes are on different Ids you also do not need to give a port range - transport.tcp.port: 9300 should do.


(vijayakrishna Gade) #5

Hi Christian, thanks for your quick reply, now i see list of 4 nodes in the cluster.

But final thing is i have added node.master: true and node.data: false on node1 and node2 but i see only node2 showing as master in the list, in this case do i need to add discovery.zen.minimum_master_nodes: 2 on all 4 nodes to setup node1 and node2 as master nodes?

curl -XGET http://localhost:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10.0.0.3 31 45 0 0.00 0.05 0.07 di - node3
10.0.0.2 33 45 0 0.05 0.03 0.05 mi * node2
10.0.0.1 31 46 1 0.33 0.16 0.10 mi - node1
10.0.0.4 31 46 0 0.00 0.03 0.05 di - node4


(vijayakrishna Gade) #6

i have added discovery.zen.minimum_master_nodes: 2 on all 4 nodes and restarted service and still see node2 as master and other nodes are data, when i checked cluster health it says total nodes 4 and data nodes 2 what about another node, do i need to update anything in the configuration, please suggest me, Thanks.

curl -XGET "http://localhost:9200/_cluster/health"
{"cluster_name":"myescluster","status":"green","timed_out":false,"number_of_nodes":4,"number_of_data_nodes":2,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0}


(Christian Dahlqvist) #7

You should always aim to have at least 3 master-eligible nodes in the cluster. 2 is not a good number. Only one will be acting as master at any time.


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.