Hi! I have a clean and simple installation os ES:
9 nodes: 6 data and 3 masters(without data).
I want to determine situation when one of masters gone for some reason(power off).
How I can do it on 7 ES? I looked at /_cluster/health and /_nodes endpoints and documentation, but failed to found answers.
Endpoints above show only available nodes and didn't show powered off nodes.
On previous version os ES(6) I could do it easily:
Get minimum_master_nodes property from /_settings
Get all nodes, count masters, and compare them with minimum_master_nodes.
If count of masters wich I get from API <= minimum_master_nodes, so, some master nodes down.
From version 7 there are no options discovery.zen.minimum_master_nodes.
How I can do something similar?
P.S. It would be great to do this check without hardcode master nodes(or their count) somewhere. And sorry for my English
You could use _cat/nodes, this shows what roles each node is set to and which is the master.
But you'd need to maintain the state of what that should look like yourself, as the APIs do not do that.
We use the cloud in production (for simplicity we can assume that these are Kubernetes).
There is a special balancing mechanism in the cloud that can move instances (containers) between HW servers (even if it is stateful).
Our goal is to prevent a situation where the cloud decides to transfer two of the three masters at once simultaneously.
Each instance report to the cloud about itself(making some health check locally). The cloud looks at report and makes a decision: can an instance be stopped or moved. To do this, each instance must have information about the state of the cluster (about the availability of other masters).
For example, master1 must know, about availability of master2 and master3, to allow the cloud to stop or move it.
Without this information, we can get a situation where two from three master instances stopped by the cloud and we lose ES cluster.
Unfortunately, _/cluster/health and other endpoint do not give any information if one of master gone.
So, the goal: each node must know current cluster state.
Yes, we can use some external services like consul or hardcoded cluster nodes, but it would be great if ES cluster could report about his master nodes state(if I understand correctly, each master already store information about other masters, but that information unavailable from API)
Sorry for the long and possibly confusing explanation.
@Vinayak_Sapre, hi! No, it's not Kubernetes, but, in Kubernetes terminology, we have three total independent Kubernetes clusters. One of three ES master in each cluster. So, we have the same problem - one Kubernete cluster doesn't know anything about other clusters and applications. But application(ES) know about itself.
So if I state in another way, you want to be alerted when one of your master is not in the cluster anymore. Since shards are only sitting on data nodes, health will still show as green.
Any other constraints you want to highlight here ?
That is a good way, though I wonder when a master will drop from that list, i.e. no longer be failed.
Also can do like this and count the nodes with the 'm' in their role and compare to your goal of 3; if only 2; you've lost a master.
GET /_cat/nodes?h=name,node.role
You can just put up a watcher with http(s) input and make a call to _nodes/master:true endpoint. In condition, check if ctx.payload._nodes.total < expected_masters, return true and trigger action of your like - mail, slack, add doc in alerts index, etc. etc.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.