Trying to replicate across two remote servers - elasticsearch

I have two Elastic Search on different VPSs with their own host names and I haven't been able to get them to replicate to each other. They are both version 0.90.2.
My settings are:
cluster.name: mycluster
name.name: "nodeA"
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: ["nodeB.example.com"]
and:
cluster.name: mycluster
name.name: "nodeB"
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: ["nodeA.example.com"]
When I attempt to start the nodeB instance the result is:
[INFO ][discovery.zen] [nodeB]
failed to send join request to master
[[nodeA][IZFgtrTPSISQR7VklS3www][inet[/*.*.*.*:9300]]{master=true}],
reason [org.elasticsearch.ElasticSearchTimeoutException:
Timeout waiting for task.]
So communication is there because nodeB knows the others name is 'nodeA', but what I am I missing or what can I check?
UPDATE:
Unfortunately this turned out to be a server issue on nodeB and had nothing to do with ES.
For the record, the above settings work fine and the unicast setting for nodeA is pointless as nodeB is not a master only nodeB needs to know about nodeA.

UPDATED:
Make the following in both config files:
discovery.zen.ping.unicast.hosts: ["master_node_ip"]
If provided settings above is the all of it. Then you should add cluster name to your settings.
cluster.name: my_cool_cluster_name

Related

Nodes not joining cluster in Elasticsearch 5.1 cluster

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

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.

Elasticsearch Cluster - No known master node, scheduling a retry

I have a server running elasticsearch and kibana. I have added a second node to form a cluster but only want that second node to replicate data from the master node.
Based on limited documentation on how to do this, I am running into issue on second with following error
[DEBUG][action.admin.indices.get ] [Match] no known master node, scheduling a retry
I am unable to determine the best configuration for both servers to achieve this but this is what I have done so far:
Master Node Config:
cluster.name: elasticsearch
node.master: true
path.data: /local00/elasticsearch/
path.work: /local00/el_temp/
network.host: 0.0.0.0
http.port: 9200
script.disable_dynamic: true
Node 2
cluster.name: elasticsearch
node.master: false
node.data: true
index.number_of_shards: 5
index.number_of_replicas: 1
path.data: /local00/elasticsearch/
path.work: /local00/el_temp/
network.host: 0.0.0.0
http.port: 9200
script.disable_dynamic: true
I am assuming I am missing additional config somewhere. Any help will be much appreciated.
Got it working with following changes answered here How to set up ES cluster?:
Node 1:
cluster.name: mycluster
node.name: "node1"
node.master: true
node.data: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["node1.example.com"]
Node 2:
cluster.name: mycluster
node.name: "node2"
node.master: false
node.data: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["node1.example.com"]
If you are trying to connect additional node to already existed ES cluster, make sure that this node also have all the same ES plugins as another nodes. If not - node cant be fully connected (other nodes can show it as connected but http-commands cant be launched on it) to ES cluster with error like:
[2016-07-21 11:56:59,564][DEBUG][action.admin.cluster.health] [dev-marvel1] no known master node, scheduling a retry
[2016-07-21 11:57:05,313][INFO ][rest.suppressed ] /_cluster/health Params: {pretty=true}
MasterNotDiscoveredException[waited for [30s]]
at org.elasticsearch.action.support.master.TransportMasterNodeAction$4.onTimeout(TransportMasterNodeAction.java:154)
at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:239)
at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:574)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
In my case problem was with license plugin. After removing it everything became fine.
If you are searching for this because you are working on your local machine then the quickest solution is to free up nodes that are hung by individually killing all the processes. I searched for these processes using.
ps -alx | grep elastic
kill -9 {pid}

Elasticsearch cluster initialization

I just setup a 3 node Elasticsearch cluster, with each node having common settings (pasted at the end of the post)
However, when I start my master node, and try to get the cluster status or even check if any one of the nodes is up, I get a 503 as the status code. Also, shutdowns (on any of the nodes) do not work.
Could someone please tell me what I'm doing wrong here? The log file on Node 1 says:
[ESNode1] observer: timeout notification from cluster service. timeout setting [30s], time since start [30s]
Here's snippets from the elasticsearch.yml config files:
Node 1
cluster.name: myCluster
node.name: ESNode1
node.master: true
node.data: true
discovery.zen.minimum_master_nodes: 2
discover.zen.ping.timeout: 20s #just for good measure
discovery.zen.ping.multicast.enabled: false
Node 2
cluster.name: myCluster
node.name: ESNode2
node.master: true
node.data: true
discovery.zen.minimum_master_nodes: 2
discover.zen.ping.timeout: 20s
discovery.zen.ping.multicast.enabled: false
Node 3
cluster.name: myCluster
node.name: ESNode3
node.master: false
node.data: true
discovery.zen.minimum_master_nodes: 2
discover.zen.ping.timeout: 20s
discovery.zen.ping.multicast.enabled: false
Thank you!
You configure that the minimum master nodes is 2. This means your cluster needs at least two master nodes. This is fine, however, together with the setting discovery.zen.ping.multicast.enabled: false this is hard to get working. This setting means you are not going to look for other nodes. So you should configure the nodes manually using the setting hosts.
You can find more information here:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#unicast
An example for three nodes running on one machine:
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
Disabling multicast discovery means discovery pings will only be sent to specific addresses. The addresses/hosts are those specified in discovery.zen.ping.unicast.hosts.
Note that a single address can be specified. When a node joins it becomes aware of all nodes in the cluster, and can start communicating with them directly.
To clarify using Jettros' example:
discovery.zen.unicast.hosts:["127.0.0.1:9300"]
will cause the nodes bound to 9301 and 9302 to ping only 9300.
If 9301 joins first it 'already knows' all other nodes in the cluster (just 9300).
If 9302 subsequently joins it will become aware of 9301 and vice-versa.
If 9301 and 9302 cant join with 9300 the cluster will not be formed.

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.

Resources