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 "joe.cohen.m@gmail.com" <jo...@gmail.com> on 2012/11/22 16:21:20 UTC

How to get a list of servers per collection in sorlcloud using java api?

I want to write a function that will go thorugh all the servers that store a
specific collection and perform a tsk on it, suppose RELOAD CORE task.
How can I get a list of all solr servers/urls that run a specific
collection?



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-get-a-list-of-servers-per-collection-in-sorlcloud-using-java-api-tp4021863.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to get a list of servers per collection in sorlcloud using java api?

Posted by Sami Siren <ss...@gmail.com>.
On Thu, Nov 22, 2012 at 7:20 PM, joe.cohen.m@gmail.com <
joe.cohen.m@gmail.com> wrote:

> Thanks Rakudten.
> I had my question mis-phrased.
> What I need is being able to get the solr servers storing a collection by
> giving the zookeeper server as an input.
>
> something like:
>
> // returns a list of solr servers in the zookeeper ensemble that store the
> given collection
> List<String> getServers(String zkhost, String collectionName)
>

You can use ZKStateReader (#getClusterState) to get this info.

--
 Sami Siren

Re: How to get a list of servers per collection in sorlcloud using java api?

Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello,

As far as I know, you cannot do that at the moment, :-/

Regards,


 - Luis Cappa.


2012/11/22 joe.cohen.m@gmail.com <jo...@gmail.com>

> Thanks Rakudten.
> I had my question mis-phrased.
> What I need is being able to get the solr servers storing a collection by
> giving the zookeeper server as an input.
>
> something like:
>
> // returns a list of solr servers in the zookeeper ensemble that store the
> given collection
> List<String> getServers(String zkhost, String collectionName)
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-get-a-list-of-servers-per-collection-in-sorlcloud-using-java-api-tp4021863p4021883.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 

- Luis Cappa

Re: How to get a list of servers per collection in sorlcloud using java api?

Posted by "joe.cohen.m@gmail.com" <jo...@gmail.com>.
Thanks Rakudten.
I had my question mis-phrased.
What I need is being able to get the solr servers storing a collection by
giving the zookeeper server as an input.

something like:

// returns a list of solr servers in the zookeeper ensemble that store the
given collection
List<String> getServers(String zkhost, String collectionName)




--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-get-a-list-of-servers-per-collection-in-sorlcloud-using-java-api-tp4021863p4021883.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to get a list of servers per collection in sorlcloud using java api?

Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello, Joe.

Try something like this using SolrJ library:

String endpoints[] = // your Solr server endpoints. Example:
http://localhost:8080/solr/core1
String zookeeperEndpoints = // your Zookeeper endpoints. Example:
localhost:9000
String collectionName = // Your collection name. Example: core1

LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(endpoints);
this.cloudSolrServer = new CloudSolrServer(zookeeperEndpoints,
lbSolrServer);
this.cloudSolrServer.setDefaultCollection(collectionName);


You have now created a CloudSolrServer instance which can manage Solr
server operations: add a new document, delete, update, etc.

Regards,


 - Luis Cappa.

2012/11/22 joe.cohen.m@gmail.com <jo...@gmail.com>

> I want to write a function that will go thorugh all the servers that store
> a
> specific collection and perform a tsk on it, suppose RELOAD CORE task.
> How can I get a list of all solr servers/urls that run a specific
> collection?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-get-a-list-of-servers-per-collection-in-sorlcloud-using-java-api-tp4021863.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 

- Luis Cappa