You need to also verify the node hosting the replica is a live node (/live_nodes). From SolrJ, you can call: clusterState.getLiveNodes().contains(node).
As for API, there is CLUSTERSTATE provided by the Collection API, but it's not consulting /live_nodes (which is a bug) - I'll open a ticket. On Thu, Sep 4, 2014 at 4:37 AM, manohar211 <manohar.srip...@gmail.com> wrote: > 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(); > 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 > > > > -- > 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.