ElasticSearch Cluster with two Nodes

I've always appreciated the support of this community, and I hope it can assist me once more. Here's the situation: I currently have Elasticsearch installed on my VM1, but I've encountered disk space issues, and the cluster status is yellow. To address this, I've created another VM, VM2, on the same host with the intention of forming an Elasticsearch cluster with two nodes across the two VMs. However, I'm facing difficulties in getting this configuration to work correctly. I'm sharing the .yml configuration files for both nodes and would greatly appreciate any guidance or assistance in resolving this issue.

VM1

cluster.name: sang-application
node.name: sangh2
network.host: vm1-ip
http.port: 9200
path.logs: /var/log/elasticsearch
path.data: /var/lib/elasticsearch
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["sangh2"]
discovery.seed_hosts: ["vm1-ip", "vm2-ip"]
cluster.initial_master_nodes: ["sangh2"]
http.host: 0.0.0.0

VM2

cluster.name: sang-application
node.name: sangh5
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: vm2-ip
http.port: 9200
discovery.seed_hosts: ["vm1-ip", "vm2-ip"]
xpack.security.enabled: false

xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["sangh5"]
http.host: 0.0.0.0

With two nodes your cluster can have just one as a master, in your configuration both nodes have all the roles, you need to change that.

Your second node cannot have the master role, so you need something like this in your elasticsearch.yml

node.roles: [data]

You also need to change your discovery.seed_hosts to have only the vm1-ip, which is the master node.

And remove the cluster.initial_master_nodes as you already have a cluster formed.

You didn't say or share anything about this, but with this configuration it is possible that your second vm formed a different cluster as a single node, can you share the logs for both cluster to help understand what are those difficulties?

Exactly my second node is forming an independent cluster. in the logs of both the VMs I am getting the following exception-

master_not_discovered_exception

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