Is there a way by which i could get to know when elasticsearch server start/stops. Something like state listener.
I'm using java to connect to elasticsearch node. The java code is responsible for inserting documents into elasticsearch. If while inserting data, elasticsearch stops (or is killed manually), the documents should not be processed till the server is on. Although I get NoNodeAvailable exception in such case, but it would be better to get a listener interface for nodes.
Something like I have already implemented for cassandra using "Host.stateListener".
if you are using the TransportClient, you can use the sniffing option which polls the cluster state in the background to dynamically add or remove hosts to send queries to.
But that would require me to check the state every time right. I'm using TransportClient Sniffing option already, but only during initialization. Also, Currently its a single node cluster.
Currently the solution I'm looking for is,
class abc implements SomeListener
{
@override
public void onUp() {
//Do something here
}
@override
public void onDown() {
Do something
}
}
So whenever elasticsearch is started, onUp() will be called, and when it shut downs, onDown() will be called.
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.