xxxxxxxxxx
<response>
<lst name="cluster">
<lst name="collections">
<lst name="collection1">
<str name="pullReplicas">0</str>
<str name="replicationFactor">2</str>
<lst name="shards">
<lst name="shard1">
<str name="range">80000000-ffffffff</str>
<str name="state">active</str>
<lst name="replicas">
<lst name="core_node3">
<str name="core">collection1_shard1_replica_n1</str>
<str name="base_url">http://192.168.2.33:8984/solr</str>
<str name="node_name">192.168.2.33:8984_solr</str>
<str name="state">active</str>
<str name="type">NRT</str>
<str name="force_set_state">false</str>
</lst>
<lst name="core_node5">
<str name="core">collection1_shard1_replica_n2</str>
<str name="base_url">http://192.168.2.33:8983/solr</str>
<str name="node_name">192.168.2.33:8983_solr</str>
<str name="state">active</str>
<str name="type">NRT</str>
<str name="force_set_state">false</str>
<str name="leader">true</str>
</lst>
</lst>
</lst>
<lst name="shard2">
<str name="range">0-7fffffff</str>
<str name="state">active</str>
<lst name="replicas">
<lst name="core_node7">
<str name="core">collection1_shard2_replica_n4</str>
<str name="base_url">http://192.168.2.33:8984/solr</str>
<str name="node_name">192.168.2.33:8984_solr</str>
<str name="state">active</str>
<str name="type">NRT</str>
<str name="force_set_state">false</str>
<str name="leader">true</str>
</lst>
<lst name="core_node8">
<str name="core">collection1_shard2_replica_n6</str>
<str name="base_url">http://192.168.2.33:8983/solr</str>
<str name="node_name">192.168.2.33:8983_solr</str>
<str name="state">active</str>
<str name="type">NRT</str>
<str name="force_set_state">false</str>
</lst>
</lst>
</lst>
</lst>
<lst name="router">
<str name="name">compositeId</str>
</lst>
<str name="maxShardsPerNode">2</str>
<str name="autoAddReplicas">false</str>
<str name="nrtReplicas">2</str>
<str name="tlogReplicas">0</str>
<int name="znodeVersion">6</int>
<arr name="aliases">
<str>collection_1_alias</str>
</arr>
<str name="configName">_default</str>
</lst>
</lst>
<lst name="aliases">
<str name="collection_1_alias">collection1</str>
</lst>
<arr name="live_nodes">
<str>192.168.2.33:8983_solr</str>
<str>192.168.2.33:8984_solr</str>
</arr>
</lst>
</response>
xxxxxxxxxx
private void getClusterStatus(final int jettyPort) throws IOException {
final String url = "http://localhost:"
+ jettyPort
+ "/solr/admin/collections?action=CLUSTERSTATUS";
final HttpGet request = new HttpGet(url);
try (final CloseableHttpClient client = HttpClientBuilder.create().build();
final CloseableHttpResponse response = client.execute(request)) {
final HttpEntity entity = response.getEntity();
System.out.println(IOUtils.toString(entity.getContent(), "UTF-8"));
// close the content stream.
EntityUtils.consumeQuietly(entity);
}
}