Setting up ElasticSearch cluster on different VPS - elasticsearch

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.

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

Related

Want to setup a two-node elastic search cluster on same machine

I am on elastic search [7.10.1. For learning purposes want to setup a clutser of two nodes on the same host. Unable to find a configuration which works for me.
I have done same elastic serach installation in two different folders node1 and node2.
node1 elasticsearch.yml file:
...
cluster.name: tktest_esclutser
node.name: tkesnode-1
http.port: 19200
transport.port: 19201
discovery.seed_hosts: ["localhost:29200"]
...
node2 elasticsearch.yml file:
...
cluster.name: tktest_esclutser
node.name: tkesnode-2
http.port: 29200
transport.port: 29201
discovery.seed_hosts: ["localhost:19200"]
...
For some reason cluster is not being formed. log file shows master-node could not be discovered.
Below configuration works perfectly fine for me, initially you may have to delete the folders inside the data folder of both nodes to start with clean state.
Node 1 elasticsearch.yml
cluster.name: es_710
node.name: opster
http.port: 9900
cluster.initial_master_nodes: ["opster"]
Node 2 elasticsearch.yml
http.port: 9910
xpack.ml.enabled: false
cluster.name: es_710
cluster.initial_master_nodes: ["opster"]

How to set up multi-node Elasticsearch cluster in development mode?

I have an ES cluster (v 5.6.12) up and running in dev mode, config below:
node1.com
cluster.name: elastic-test
node.name: "node-1"
path.data: /path/to/data
path.logs: /path/to/logs
network.host: 127.0.0.1
http.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["node1.com", "node2.com"]
node.master: true
I am trying to connect node 2 to the same cluster:
node2.com
cluster.name: elastic-test
node.name: "node-2"
path.data: /path/to/data
path.logs: /path/to/logs
network.host: 127.0.0.1
http.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["node1.com", "node2.com"]
node.master: true
I tried to change the network.host to their respective addresses, but this takes them out of dev mode. I also tried setting the bind and publish hosts to make the node discover-able to other nodes:
network.bind_host: 127.0.0.1
network.publish_host: node1.com
But again, this takes the nodes into production.
Is it actually possible to have multiple nodes on different servers communicate within development mode?
Short answer NO. For most use cases running a single node cluster for DEV suffices but there could be scenarios where multi node clusters are required in DEV environment, however it is not possible to currently form a multi node cluster without binding to a non local IP address.
That being said, difference between development mode and production mode with respect to Elasticsearch is just preventing ES cluster from starting if some settings are not configured appropriately. So, as long as you are able to configure the settings described in the below link then you can form a cluster and name it as DEV so users don't misidentify it as a production cluster
https://www.elastic.co/guide/en/elasticsearch/reference/5.6/system-config.html#dev-vs-prod

Failed to send join request to master ElasticSearch on AWS EC2 owned cluster

I am trying to build a cluster of 3 EC2 instances (I do not want to use the ElasticSearch service of amazon) and after installing the software and configuring it in all three instances I encounter the problem that they do not communicate with each other.
I’m working with ES 5.5.1 on instances with Ubuntu 16.04
All nodes are up and running
All nodes has a Security Groupof AWS with permissions for all traffic between nodes (all ports)
Internal firewall on very machine white list for every node
Master
cluster.name: excelle
node.name: ${HOSTNAME}
node.master: true
path.data: /srv/data
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 172.31.MAS.TER
discovery.zen.ping.unicast.hosts: ["172.31.MAS.TER", "172.31.NODE.TWO", "172.31.NODE.THREE"]
Node two
cluster.name: excelle
node.name: ${HOSTNAME}
node.master: false
path.data: /srv/data
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 172.31.NODE.TWO
discovery.zen.ping.unicast.hosts: ["172.31.MAS.TER", "172.31.NODE.TWO", "172.31.NODE.THREE"]
Node 3
cluster.name: excelle
node.name: ${HOSTNAME}
node.master: false
path.data: /srv/data
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 172.31.NODE.THREE
discovery.zen.ping.unicast.hosts: ["172.31.MAS.TER", "172.31.NODE.TWO", "172.31.NODE.THREE"]
But on logs, on node 3 for exmple...
[2017-08-15T11:01:41,241][INFO ][o.e.d.z.ZenDiscovery ] [es03] failed to send join request to master [{esmaster}{scquEEaETDKMKLHzZvEHZQ}{NdLtMUXtT7WXnv1a4uHWqQ}{172.31.44.107}{172.31.44.107:9300}], reason [RemoteTransportException[[esmaster][172.31.44.107:9300][internal:discovery/zen/join]]; nested: ConnectTransportException[[es03][172.31.18.76:9300] connect_timeout[30s]]; nested: IOException[connection timed out: 172.31.18.76/172.31.18.76:9300]; ]
I testing connection from node 3 to master not problem (for network question)
telnet 172.31.MAS.TER 9300
Trying 172.31.MAS.TER...
Connected to 172.31.MAS.TER.
Escape character is '^]'.
What it's wrong? Any idea?
I found an answer to this posted on ElasticSearch
The gem was from manst:
"solution for this error (you must deleted contents of data folder(/var/lib/elasticsearch/nodes/0) and restarted both the servers ):"
I deleted the nodes folder from each of my SpotInst instances and rebooted. My 3 ES distributed master-only nodes all came online. My 8 data-only nodes have connected automatically without any issue.

Elasticsearch cluster instances are showing up as an individual masters

I am trying to deploy a 2 node elasticsearch cluster.
I have 2 VM's as follow:
VM1 -> 10.20.1.4 (CentOS7)
VM2 -> 10.20.1.5 (CentOS7)
I have installed java8 as a prerequisite in both the above VM.
Downloaded the elasticsearch tar from below link:
https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz
In VM1 (10.20.1.4), I have below configuration in elasticsearch.yml file
cluster.name: TestCluster
node.name: "node1"
node.master: true
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["10.20.1.4:9300", "10.20.1.5:9300"]
In VM2 (10.20.1.5), I have below configuration in elasticsearch.yml file
cluster.name: TestCluster
node.name: "node2"
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["10.20.1.4:9300", "10.20.1.5:9300"]
But with this configuration, when I start elasticsearch instance, both the instances are coming up as an individual master node. They are not forming the cluster as they are unable to discover them.
I have also tried below variation of zen unicast but none of them are working for me
discovery.zen.ping.unicast.hosts: ["10.20.1.4:9200", "10.20.1.5:9200"]
OR
discovery.zen.ping.unicast.hosts: ["10.20.1.4", "10.20.1.5"]
OR
discovery.zen.ping.unicast.hosts: ["node1", "node2"]
Can someone please help me to get this elasticsearch cluster work.
It's because the ES server is bound to localhost by default, i.e. in your config you can see this network.bind_host: _local_
They took that decision to prevent ES clusters from forming with undesired hosts from the outside world.
Instead you should set the following setting on each of your hosts:
network.host: 10.20.1.4 # on VM1
and
network.host: 10.20.1.5 # on VM2
Note that setting network.host will set both network.bind_host and network.publish_host to the same IP address.

Elastic data node with shield

but it can't working after I setup shield
I added user to elastic by command
shield/esusers useradd es_admin -r admin
This is my master node config
cluster.name: vision
node.name: "node_master"
node.master: true
node.data: false
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.1.5"]
path.logs: /var/elastic/log
path.data: /var/elastic/data
This is my data node config
cluster.name: vision
node.name: "node_data"
node.master: false
node.data: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.1.5"]
path.logs: /var/elastic/log
path.data: /var/elastic/data
How can I connect data node to master node?
There is no extra work you need to do to join data and master node to form a cluster.It treats both type of nodes same.
Your hosts setting is mentioning only one host.
discovery.zen.ping.unicast.hosts: ["host1:port","host2:port"]
Each node will keep pinging the hosts listed above until both are initialized.Adding the local host is of no harm to array as ping wont fail but help in automated deployement of elasticsearch on multinode ecosystem.
since you are using shield make sure if you enabled ssl for node communicatioon then also specify the path to SSL keystore files.

Resources