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 as mentioned in the below URL.
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();
Collection<Slice> slices = reader.getClusterState().getSlices(collection);
Iterator<Slice> 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