# Client Node using Local Cluster Metadata

**URL:** https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433
**Category:** Elasticsearch
**Created:** [April 3, 2013, 5:27pm UTC](https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433 "2013-04-03T17:27:56Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![amos\_wood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amos_wood/32/1880_2.png) [@amos\_wood](https://discuss.elastic.co/u/amos_wood)
#### Post date: [April 3, 2013, 5:27pm UTC](https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433/1 "2013-04-03T17:27:56Z")

</div>

We have an ES cluster which is fronted by a service layer. Each  
distributed JBoss server which holds our service launches a Client Node and  
joins the cluster using multicast discoverty. We are currently utilizing 4  
JBoss servers for failover and load balancing.

In our service, I would like to make certain decisions about how to custom  
route information based upon the cluster MetaData  
(org.elasticsearch.cluster.metadata.MetaData) which is returned from the  
ClusterStateRequest.

I am exploring the use of the ClusterStateRequest#local(true) option. If I  
use the "local(true)" functionality, the MetaData is returned instantly  
which makes me think that it is getting it from the local Client Node. If  
it is false, it is not instant which makes me think that it is requesting  
the state from the master node instead.

My question is how often or frequent is a client node local cluster  
MetaData updated when the cluster MetaData is changed?

Also, is there a notification system that can be accessed in the Java API  
to be notified when an index is created or removed?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [April 3, 2013, 6:52pm UTC](https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433/2 "2013-04-03T18:52:46Z")

</div>

Your assumptions about local option are correct. Master publishes all  
changes in cluster state to all nodes as soon as it receives them. There is  
no official way to register for cluster state change notifications in Java  
API, but if you have access to client node you can hack your way through by  
getting ClusterService and registerring your ClusterStateListener with it.

On Wednesday, April 3, 2013 1:27:56 PM UTC-4, amos.wood wrote:

> We have an ES cluster which is fronted by a service layer. Each  
> distributed JBoss server which holds our service launches a Client Node and  
> joins the cluster using multicast discoverty. We are currently utilizing 4  
> JBoss servers for failover and load balancing.
> 
> In our service, I would like to make certain decisions about how to custom  
> route information based upon the cluster MetaData  
> (org.elasticsearch.cluster.metadata.MetaData) which is returned from the  
> ClusterStateRequest.
> 
> I am exploring the use of the ClusterStateRequest#local(true) option. If  
> I use the "local(true)" functionality, the MetaData is returned instantly  
> which makes me think that it is getting it from the local Client Node. If  
> it is false, it is not instant which makes me think that it is requesting  
> the state from the master node instead.
> 
> My question is how often or frequent is a client node local cluster  
> MetaData updated when the cluster MetaData is changed?
> 
> Also, is there a notification system that can be accessed in the Java API  
> to be notified when an index is created or removed?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![amos\_wood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amos_wood/32/1880_2.png) [@amos\_wood](https://discuss.elastic.co/u/amos_wood)
#### Post date: [April 3, 2013, 7:33pm UTC](https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433/3 "2013-04-03T19:33:06Z")

</div>

Just to clarify ... the master will publish all Metadata changes to the  
Client Node as soon as it receives them?

Just to clarify ... using the ClusterStateRequest#local(true) option will  
retrieve the MetaData from the Client node only without going to the Master  
for it?

On Wednesday, April 3, 2013 1:52:46 PM UTC-5, Igor Motov wrote:

> Your assumptions about local option are correct. Master publishes all  
> changes in cluster state to all nodes as soon as it receives them. There is  
> no official way to register for cluster state change notifications in Java  
> API, but if you have access to client node you can hack your way through by  
> getting ClusterService and registerring your ClusterStateListener with it.
> 
> On Wednesday, April 3, 2013 1:27:56 PM UTC-4, amos.wood wrote:
> 
> > We have an ES cluster which is fronted by a service layer. Each  
> > distributed JBoss server which holds our service launches a Client Node and  
> > joins the cluster using multicast discoverty. We are currently utilizing 4  
> > JBoss servers for failover and load balancing.
> > 
> > In our service, I would like to make certain decisions about how to  
> > custom route information based upon the cluster MetaData  
> > (org.elasticsearch.cluster.metadata.MetaData) which is returned from the  
> > ClusterStateRequest.
> > 
> > I am exploring the use of the ClusterStateRequest#local(true) option. If  
> > I use the "local(true)" functionality, the MetaData is returned instantly  
> > which makes me think that it is getting it from the local Client Node. If  
> > it is false, it is not instant which makes me think that it is requesting  
> > the state from the master node instead.
> > 
> > My question is how often or frequent is a client node local cluster  
> > MetaData updated when the cluster MetaData is changed?
> > 
> > Also, is there a notification system that can be accessed in the Java API  
> > to be notified when an index is created or removed?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [April 3, 2013, 8:07pm UTC](https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433/4 "2013-04-03T20:07:18Z")

</div>

MetaData is a part of cluster state. So, yes and yes.

On Wednesday, April 3, 2013 3:33:06 PM UTC-4, amos.wood wrote:

> Just to clarify ... the master will publish all Metadata changes to the  
> Client Node as soon as it receives them?
> 
> Just to clarify ... using the ClusterStateRequest#local(true) option will  
> retrieve the MetaData from the Client node only without going to the Master  
> for it?
> 
> On Wednesday, April 3, 2013 1:52:46 PM UTC-5, Igor Motov wrote:
> 
> > Your assumptions about local option are correct. Master publishes all  
> > changes in cluster state to all nodes as soon as it receives them. There is  
> > no official way to register for cluster state change notifications in Java  
> > API, but if you have access to client node you can hack your way through by  
> > getting ClusterService and registerring your ClusterStateListener with it.
> > 
> > On Wednesday, April 3, 2013 1:27:56 PM UTC-4, amos.wood wrote:
> > 
> > > We have an ES cluster which is fronted by a service layer. Each  
> > > distributed JBoss server which holds our service launches a Client Node and  
> > > joins the cluster using multicast discoverty. We are currently utilizing 4  
> > > JBoss servers for failover and load balancing.
> > > 
> > > In our service, I would like to make certain decisions about how to  
> > > custom route information based upon the cluster MetaData  
> > > (org.elasticsearch.cluster.metadata.MetaData) which is returned from the  
> > > ClusterStateRequest.
> > > 
> > > I am exploring the use of the ClusterStateRequest#local(true) option.  
> > > If I use the "local(true)" functionality, the MetaData is returned  
> > > instantly which makes me think that it is getting it from the local Client  
> > > Node. If it is false, it is not instant which makes me think that it is  
> > > requesting the state from the master node instead.
> > > 
> > > My question is how often or frequent is a client node local cluster  
> > > MetaData updated when the cluster MetaData is changed?
> > > 
> > > Also, is there a notification system that can be accessed in the Java  
> > > API to be notified when an index is created or removed?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:42am UTC](https://discuss.elastic.co/t/client-node-using-local-cluster-metadata/11433/5 "2017-07-06T02:42:56Z")

</div>


