Re: Solr API for getting shard's leader/replica status

2014-09-05 Thread manohar211
Thanks for the comments!!
I found out the solution on how I can get the replica's state. Here's the
piece of code.

while (iter.hasNext()) {
Slice slice = iter.next();
for(Replica replica:slice.getReplicas()) {

System.out.println(replica state for  + replica.getStr(core)
+  : + replica.getStr( state ));

System.out.println(slice.getName());
System.out.println(slice.getState());
}
}



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-API-for-getting-shard-s-leader-replica-status-tp4156902p4157108.html
Sent from the Solr - User mailing list archive at Nabble.com.


Solr API for getting shard's leader/replica status

2014-09-04 Thread manohar211
Solr has a Admin UI where we can check each and every Collections that were
deployed to Solr Cloud. For example, I can see a Slice/Shard in a collection
up or not in the mentioned diagram. 
http://lucene.472066.n3.nabble.com/file/n4156902/cloud-graph.png 

Our production environment doesn't provide access to this Admin UI due to
security reasons. I need to provide an API to get the status of each and
every collection, and its shards and each shard's replica. I am using Solr
APIs to do that

http://lucene.apache.org/solr/4_7_2/solr-solrj/index.html

/CloudSolrServer server = new CloudSolrServer(zk quorum);
ZkStateReader reader = server.getZkStateReader();
CollectionSlice slices = reader.getClusterState().getSlices(collection);
IteratorSlice iter = slices.iterator();
while (iter.hasNext()) {
Slice slice = iter.next();
System.out.println(slice.getName());
System.out.println(slice.getState());
}/

The above piece of code is always returning Active only as the state of
shard, even its replica is showing down in the UI. I assume this returns
only the state of a shard, not the state of shard's leader or replica.

How can I get the replicas status through Solr APIs? is there any API for
this? And what is the API being using by Solr Admin UI for getting shard's
replicas/leader status?

Thanks



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-API-for-getting-shard-s-leader-replica-status-tp4156902.html
Sent from the Solr - User mailing list archive at Nabble.com.