[ElasticSearch 7.5] Cluster is failed to setup

I am failed to create a cluster with two nodes. It seems the nodes can't see each other.
But, when I debug and grep the transport port with 9300, it seems they can see each other.
~# netstat -anutp|grep 9300
tcp6 0 0 :::9300 :::* LISTEN 1431/java
tcp6 0 0 192.168.111.79:9300 192.168.111.50:45172 ESTABLISHED 1431/java
tcp6 0 0 192.168.111.79:9300 192.168.111.50:45178 ESTABLISHED 1431/java
tcp6 0 0 192.168.111.79:9300 192.168.111.50:45188 ESTABLISHED 1431/java
tcp6 0 0 192.168.111.79:9300 192.168.111.50:45182 ESTABLISHED 1431/java

From below api, we can only see there is only one node by itself:
~# curl localhost:9200/_nodes/process?pretty
{
"_nodes" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"cluster_name" : "labcar02",
"nodes" : {
"MafoliosT5WtpldQffh5CQ" : {
"name" : "node-1",
"transport_address" : "192.168.111.79:9300",
"host" : "192.168.111.79",
"ip" : "192.168.111.79",
"version" : "7.5.1",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "3ae9ac9a93c95bd0cdc054951cf95d88e1e18d96",
"roles" : [
"ingest",
"master",
"data",
"ml"
],
"attributes" : {
"ml.machine_memory" : "8192053248",
"xpack.installed" : "true",
"ml.max_open_jobs" : "20"
},
"process" : {
"refresh_interval_in_millis" : 1000,
"id" : 1431,
"mlockall" : false
}
}
}
}

The two nodes info:
|- node name: node-1, node-2
|- hostname: TC-LarCar002, bt. The dns server works normally and it's successful to resolve hostname on both nodes.
|- IP: TC-LarCar002(192.168.111.79), bt(192.168.111.50)
|- elasticsearch config files

The elasticsearch.yml on node-1

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

cluster.name: labcar02

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

node.name: node-1

Add custom attributes to the node:

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

path.data: /var/lib/elasticsearch

Path to log files:

path.logs: /var/log/elasticsearch

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 0.0.0.0

Set a custom port for HTTP:

http.port: 9200

For more information, consult the network module documentation.

--------------------------------- Discovery ----------------------------------

Pass an initial list of hosts to perform discovery when this node is started:

discovery.seed_hosts: ["192.168.111.50", "192.168.111.79"]

Bootstrap the cluster using an initial set of master-eligible nodes:

cluster.initial_master_nodes: ["TC-LarCar002"]

For more information, consult the discovery and cluster formation module documentation.

---------------------------------- Gateway -----------------------------------

Block initial recovery after a full cluster restart until N nodes are started:

#gateway.recover_after_nodes: 3

For more information, consult the gateway module documentation.

---------------------------------- Various -----------------------------------

Require explicit names when deleting indices:

#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"

The elasticsearch.yml on node-2

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

cluster.name: labcar02

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

node.name: node-2

Add custom attributes to the node:

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

path.data: /data/es-data

Path to log files:

path.logs: /var/log/elasticsearch

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 0.0.0.0

Set a custom port for HTTP:

#http.port: 9200

For more information, consult the network module documentation.

--------------------------------- Discovery ----------------------------------

Pass an initial list of hosts to perform discovery when this node is started:

discovery.seed_hosts: ["192.168.111.50", "192.168.111.79"]

Bootstrap the cluster using an initial set of master-eligible nodes:

cluster.initial_master_nodes: ["TC-LabCar002"]

For more information, consult the discovery and cluster formation module documentation.

---------------------------------- Gateway -----------------------------------

Block initial recovery after a full cluster restart until N nodes are started:

#gateway.recover_after_nodes: 3

For more information, consult the gateway module documentation.

---------------------------------- Various -----------------------------------

Require explicit names when deleting indices:

#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"

Could anybody please tell me why I can't see the two nodes via api:
curl http://localhost:9200/_nodes/process?pretty

Hey,

please take your time to use proper markdown formatting for snippets and config files. markdown has excellect support, makes your snippets a million times more readable and also increases your chances of a reply because of that.

Second, you may want to share the output of some logfiles to dig deeper into the problem why a node is not joining a cluster. See https://www.elastic.co/help

hope this helps as a starter!

--Alex

--Alex

1 Like

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