Nodes not joining cluster in Elasticsearch 5.1 cluster - elasticsearch

I want to setup a cluster with 3 nodes(1 master, 1 client and 1 data node) with Elasticsearch 5.1.1. I have connected 3 windows 10 machines through a wireless network and edited the elasticsearch.ymlfile of each node as follows:
master node:
cluster.name: searchapp
node.name: es-master-01
node.master: true
node.data: false
node.ingest: false
network.host: 192.168.1.3
discovery.zen.ping.unicast.hosts: ["es-client-01", "es-master-01", "es-data-01"]
client node:
cluster.name: searchapp
node.name: es-client-01
node.master: false
node.data: false
node.ingest: true
network.host: 192.168.1.4
discovery.zen.ping.unicast.hosts: ["es-client-01", "es-master-01", "es-data-01"]
data node:
cluster.name: searchapp
node.name: es-data-01
node.master: false
node.data: true
node.ingest: false
network.host: 192.168.1.2
discovery.zen.ping.unicast.hosts: ["es-client-01", "es-master-01", "es-data-01"]
When I try to run elasticsearch on the master node it gives the following output
The nodes are not joining the cluster and I tried replacing the hostnames to IPs but still the nodes aren't joining.

According to the attached logs, it seems that your elasticsearch cluster cannot resolve the host names for the machines.
I suggest to add all of your hosts names to the hosts file so each machine would know how to resolve the host names.
For linux:
/etc/hosts
For windows:
%SystemRoot%\System32\drivers\etc\hosts
Where by default, %SystemRoot% means: C:\Windows

Related

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.

How could I set up a ES cluster?

I have a master node which ip is 192.168.1.101 and a non-master node which ip is 192.168.1.106. The two use the same version of ElasticSearch-1.2.0.
But after I started the master node and the non-master node, then I got the following info:
[2014-06-04 02:38:49,350][INFO ][discovery.zen ] [node2] failed to send join request to master [[node1][TxZ5wuhnT1awPC1gEjYPdw][flyers-MacBook-Air.local][inet[/192.168.1.101:9300]]{master=true}], reason [org.elasticsearch.ElasticsearchTimeoutException: Timeout waiting for task.]
Config of the master node:
cluster.name: mycluster
node.name: "node1"
node.master: true
node.data: true
index.number_of_shards: 5
index.number_of_replicas: 1
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.1.101"]
Config of the non-master node:
cluster.name: mycluster
node.name: "node2"
node.master: false
node.data: true
index.number_of_shards: 5
index.number_of_replicas: 1
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.1.101"]
I don't know why this exception happens. Please give me some tips. Thanks in advance.
After I set network.bind_host、network.publish_host、network.host to the IP that the node held,it worked. Very strange.
I had the same issue until I found out that my ES node did not bind to eth0 as expected but to eth2 instead. Of course this could not work because the registration response from the master node could not be sent to the IP address of my other network.
I was able to fix this behaviour by setting the following parameter in my elasticsearch.yml (on the server which was not able to join the cluster)
network.publish_host: "_eth0:ipv4_"
I'd better change ["192.168.1.101"] to ["192.168.1.101", "192.168.1.106"] in both configurations.

Multiple nodes in ElasticSearch

How can I have multiple nodes in my ElasticSearch? I'm using the following in elasticsearch.yml but only the last node starts, and the browser complains: The page at file://localhost/ says: undefined.
node.name: "No Data"
node.master: true
node.data: false
node.name: "Data One"
node.master: false
node.data: true
node.name: "Data Two"
node.master: false
node.data: true
I think the simplest way to do it is by specifying these parameters on the command line. To start three nodes you just need to run the following three commands in elasticsearch home directory:
$ bin/elasticsearch -Des.node.data=false -Des.node.master=true -Des.node.name=NoData
$ bin/elasticsearch -Des.node.data=true -Des.node.master=false -Des.node.name=DataOne
$ bin/elasticsearch -Des.node.data=true -Des.node.master=false -Des.node.name=DataTwo
Another solution is to create 3 different config files and start three nodes with -Des.config=path-to-config-file parameter.
First off, you should be trying to access elasticsearch using
[http://localhost:9200/][1], if you are using the default port bindings.
I would set up your master node to also be a data node, there is no reason not to. If you are trying to start 3 nodes on a single machine. But, starting 3 nodes all on the same machine doesn't make sense as anything other than an experiment. What are you trying to accomplish?
In windows for 6.x version, command attributes change to
elasticsearch -EsomeYamlPropety=someValue
First You need change an elasticsearch.yml properties to:
http.port: 9200-9299
transport.tcp.port: 9300-9399
node.max_local_storage_nodes: 2
Because You cant run nodes on single port, and when I try to use command with argument -Ehttp.port=9201 nodes where cant see each other and they create two different clusters with the same name.
Run the first node by a standard command:
.\bin\elasticsearch
Run the second node by command with attributes:
.\bin\elasticsearch -Enode.name=NodeTwo -Enode.master=false
for running 3 elasticsearch node on one machine, you should use these configs in elasticsearch.yml file of each node:
for master node :
cluster.name: mycluster
node.name: "node1"
node.master: true
node.data: true
network.host: 127.0.0.1
http.port: 9200-9299
transport.tcp.port: 9300-9399
discovery.zen.minimum_master_nodes: 2
for data nodes :
cluster.name: mycluster
node.name: "data-node-name"
node.master: false
node.data: true
network.host: 127.0.0.1
http.port: 9200-9299
transport.tcp.port: 9300-9399
discovery.zen.minimum_master_nodes: 2
and then u should run each node by :
cd path/to/elasticsearch/bin
path\bin>elasticsearch.bat

Resources