I had a similar need. The resulting tool is in scala, but it still might be useful to look at. I had to work through some of those same issues: https://github.com/whitepages/solrcloud_manager
>From a clusterstate perspective, I mostly cared about active vs non-active, so here¹s a sample output of printing the cluster state: sbt "run -z zookeeper.example.com:2181/qa" [info] Running com.whitepages.CLI -z zookeeper.example.com:2181/qa Aliases: collection1-current -> collection1 Nodes: 101.16.0.101:8980/solr (up/used) 101.16.0.103:8980/solr (up/used) Collection Slice ReplicaName Host ActiveSlice ActiveReplica CoreName collection1 shard1* core_node2 101.16.0.103:8980/solr true true collection1 _shard1_replica1 collection1 shard1 core_node3 101.16.0.101:8980/solr true true collection1_ shard1_replica2 collection1 shard2* core_node1 101.16.0.103:8980/solr true true collection1 _shard2_replica1 collection1 shard2 core_node4 101.16.0.101:8980/solr true true collection1_ shard2_replica2 On 9/5/14, 2:21 AM, "manohar211" <manohar.srip...@gmail.com> wrote: >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-rep >lica-status-tp4156902p4157108.html >Sent from the Solr - User mailing list archive at Nabble.com.