# ElasticSearch Cluster with two Nodes

**URL:** <https://discuss.elastic.co/t/elasticsearch-cluster-with-two-nodes/343874>\
**Category:** Elasticsearch\
**Created:** [September 26, 2023, 12:10pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-with-two-nodes/343874 "2023-09-26T12:10:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyaansh\_Dwivedi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priyaansh_dwivedi/32/121317_2.png) [@Priyaansh\_Dwivedi](https://discuss.elastic.co/u/Priyaansh_Dwivedi)\
**Post date:** [September 26, 2023, 12:10pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-with-two-nodes/343874/1 "2023-09-26T12:10:39Z")

</div>

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

```auto
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**

```auto
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

```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [September 26, 2023, 12:26pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-with-two-nodes/343874/2 "2023-09-26T12:26:10Z")

</div>

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`

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

> [@Priyaansh\_Dwivedi](#):
>
> However, I'm facing difficulties in getting this configuration to work correctly.

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?

---

<div class="post-metadata">

**Author:** ![Priyaansh\_Dwivedi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priyaansh_dwivedi/32/121317_2.png) [@Priyaansh\_Dwivedi](https://discuss.elastic.co/u/Priyaansh_Dwivedi)\
**Post date:** [September 27, 2023, 8:37am UTC](https://discuss.elastic.co/t/elasticsearch-cluster-with-two-nodes/343874/3 "2023-09-27T08:37:15Z")

</div>

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

```auto
master_not_discovered_exception

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 25, 2023, 8:37am UTC](https://discuss.elastic.co/t/elasticsearch-cluster-with-two-nodes/343874/4 "2023-10-25T08:37:41Z")

</div>

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