Memphor
Memphor

Reputation: 35

Setting up ElasticSearch cluster on different VPS

I want to make a basic ElasticSearch cluster with two nodes.

I am using two VPS servers:

VPS1 has public IP address: 5.xxx.96.233

VPS2 has public IP address: 5.xxx.96.234

This is how the elasticsearch.yml file looks like (besides the default settings):

VPS1:

cluster.name: mx-cluster
node.name: mx-node-1
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["5.xxx.96.233", "5.xxx.96.234"]

VPS2:

cluster.name: mx-cluster
node.name: mx-node-2
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["5.xxx.96.233", "5.xxx.96.234"]

The ufw rules are set to allow to port 9300 from the other server.

VPS1:

9300                       ALLOW       5.xxx.96.234

VPS2:

9300                       ALLOW       5.xxx.96.233

Now an ElasticSearch instance is running on both of them, but it's unable to discover eachother to make a cluster.

Both servers are new and I only installed ElasticSearch on it.

I am not sure if this is possible or this is the way to do it, I wasn't able to find an answer online so I'm posting this.

Upvotes: 1

Views: 231

Answers (1)

Amit
Amit

Reputation: 32386

Below 2 configs issue solved the issue, I just make only 1 master node mx-node-1 which also act as a data-node and another node mx-node-1 act as only data-node.

Master and data node config(mx-node-1)

cluster.name: mx-cluster
node.name: mx-node-2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
discovery.seed_hosts: ["5.255.96.233"]
logger.org.elasticsearch.discovery: TRACE --> note used this to debug issue

Data node(mx-node-2) config

cluster.name: mx-cluster
node.name: mx-node-2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
node.master: false --> note this would mark it as data node only
discovery.seed_hosts: ["5.255.96.233"]
logger.org.elasticsearch.discovery: TRACE

Upvotes: 1

Related Questions