You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ugo Matrangolo <ug...@gmail.com> on 2014/07/03 15:49:08 UTC
Listening on SolrCloud events
Hi,
I would like to be informed as soon as a cluster event happens like a node
dropping and/or starting a recovery process.
What is the best way (if any) to listening on SolrCloud events ?
Ugo
Re: Listening on SolrCloud events
Posted by Ugo Matrangolo <ug...@gmail.com>.
Hi,
thank you very much for the answers.
I think the best way is to write a little Zookeeper watcher myself and
react on event of interest.
Thank you,
Ugo
On Thu, Jul 3, 2014 at 9:42 PM, Jeff Wartes <jw...@whitepages.com> wrote:
> If you¹re using SolrJ, CloudSolrServer exposes the information you need
> directly, although you¹d have to poll it for changes.
> Specifically, this code path will get you a snapshot of the clusterstate:
> http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/client/solrj
> /impl/CloudSolrServer.html#getZkStateReader()
>
> http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/common/cloud
> /ZkStateReader.html#updateClusterState(boolean)
>
> http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/common/cloud
> /ZkStateReader.html#getClusterState()
>
>
> If you¹re not using SolrJ, or don¹t want to poll, you really only need a
> zookeeper client. As Shawn Heisey suggests, you put a watch on the
> clusterstate.json, and write something to determine if the change was
> relevant to you.
>
> A few months ago I wanted to do analysis of changes in my SolrCloud
> cluster, so I threw together something using the Curator library to set
> watches on clusterstate.json and commit the new version to a local git
> repo whenever it changed.
> (https://github.com/randomstatistic/git_zk_monitor) The hardest part
> turned out to be learning about the Zookeeper watch semantics, but you
> could use any client you like.
>
>
>
> On 7/3/14, 9:23 AM, "Shawn Heisey" <so...@elyograg.org> wrote:
>
> >On 7/3/2014 7:49 AM, Ugo Matrangolo wrote:
> >> I would like to be informed as soon as a cluster event happens like a
> >>node
> >> dropping and/or starting a recovery process.
> >>
> >> What is the best way (if any) to listening on SolrCloud events ?
> >
> >I don't know how it's done, but if you are using SolrJ and
> >CloudSolrServer, you have access to the zookeeper client. With the
> >zookeeper client, you can put a watcher on various parts of the
> >zookeeper database, which should fire whenever there is a change.
> >
> >Thanks,
> >Shawn
> >
>
>
Re: Listening on SolrCloud events
Posted by Jeff Wartes <jw...@whitepages.com>.
If you¹re using SolrJ, CloudSolrServer exposes the information you need
directly, although you¹d have to poll it for changes.
Specifically, this code path will get you a snapshot of the clusterstate:
http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/client/solrj
/impl/CloudSolrServer.html#getZkStateReader()
http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/common/cloud
/ZkStateReader.html#updateClusterState(boolean)
http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/common/cloud
/ZkStateReader.html#getClusterState()
If you¹re not using SolrJ, or don¹t want to poll, you really only need a
zookeeper client. As Shawn Heisey suggests, you put a watch on the
clusterstate.json, and write something to determine if the change was
relevant to you.
A few months ago I wanted to do analysis of changes in my SolrCloud
cluster, so I threw together something using the Curator library to set
watches on clusterstate.json and commit the new version to a local git
repo whenever it changed.
(https://github.com/randomstatistic/git_zk_monitor) The hardest part
turned out to be learning about the Zookeeper watch semantics, but you
could use any client you like.
On 7/3/14, 9:23 AM, "Shawn Heisey" <so...@elyograg.org> wrote:
>On 7/3/2014 7:49 AM, Ugo Matrangolo wrote:
>> I would like to be informed as soon as a cluster event happens like a
>>node
>> dropping and/or starting a recovery process.
>>
>> What is the best way (if any) to listening on SolrCloud events ?
>
>I don't know how it's done, but if you are using SolrJ and
>CloudSolrServer, you have access to the zookeeper client. With the
>zookeeper client, you can put a watcher on various parts of the
>zookeeper database, which should fire whenever there is a change.
>
>Thanks,
>Shawn
>
Re: Listening on SolrCloud events
Posted by Shawn Heisey <so...@elyograg.org>.
On 7/3/2014 7:49 AM, Ugo Matrangolo wrote:
> I would like to be informed as soon as a cluster event happens like a node
> dropping and/or starting a recovery process.
>
> What is the best way (if any) to listening on SolrCloud events ?
I don't know how it's done, but if you are using SolrJ and
CloudSolrServer, you have access to the zookeeper client. With the
zookeeper client, you can put a watcher on various parts of the
zookeeper database, which should fire whenever there is a change.
Thanks,
Shawn