add number of data nodes to cluster health
This commit is contained in:
parent
b8708f276d
commit
e7fdf16402
|
@ -42,6 +42,8 @@ public class ClusterHealthResponse implements ActionResponse, Iterable<ClusterIn
|
|||
|
||||
int numberOfNodes = 0;
|
||||
|
||||
int numberOfDataNodes = 0;
|
||||
|
||||
int activeShards = 0;
|
||||
|
||||
int relocatingShards = 0;
|
||||
|
@ -157,6 +159,14 @@ public class ClusterHealthResponse implements ActionResponse, Iterable<ClusterIn
|
|||
return numberOfNodes();
|
||||
}
|
||||
|
||||
public int numberOfDataNodes() {
|
||||
return this.numberOfDataNodes;
|
||||
}
|
||||
|
||||
public int getNumberOfDataNodes() {
|
||||
return numberOfDataNodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* <tt>true</tt> if the waitForXXX has timeout out and did not match.
|
||||
*/
|
||||
|
@ -196,6 +206,7 @@ public class ClusterHealthResponse implements ActionResponse, Iterable<ClusterIn
|
|||
initializingShards = in.readVInt();
|
||||
unassignedShards = in.readVInt();
|
||||
numberOfNodes = in.readVInt();
|
||||
numberOfDataNodes = in.readVInt();
|
||||
status = ClusterHealthStatus.fromValue(in.readByte());
|
||||
int size = in.readVInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
@ -221,6 +232,7 @@ public class ClusterHealthResponse implements ActionResponse, Iterable<ClusterIn
|
|||
out.writeVInt(initializingShards);
|
||||
out.writeVInt(unassignedShards);
|
||||
out.writeVInt(numberOfNodes);
|
||||
out.writeVInt(numberOfDataNodes);
|
||||
out.writeByte(status.value());
|
||||
out.writeVInt(indices.size());
|
||||
for (ClusterIndexHealth indexHealth : this) {
|
||||
|
|
|
@ -165,6 +165,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc
|
|||
RoutingTableValidation validation = clusterState.routingTable().validate(clusterState.metaData());
|
||||
ClusterHealthResponse response = new ClusterHealthResponse(clusterName.value(), validation.failures());
|
||||
response.numberOfNodes = clusterState.nodes().size();
|
||||
response.numberOfDataNodes = clusterState.nodes().dataNodes().size();
|
||||
request.indices(clusterState.metaData().concreteIndices(request.indices()));
|
||||
|
||||
for (String index : request.indices()) {
|
||||
|
|
|
@ -89,6 +89,7 @@ public class RestClusterHealthAction extends BaseRestHandler {
|
|||
builder.field(Fields.STATUS, response.status().name().toLowerCase());
|
||||
builder.field(Fields.TIMED_OUT, response.timedOut());
|
||||
builder.field(Fields.NUMBER_OF_NODES, response.numberOfNodes());
|
||||
builder.field(Fields.NUMBER_OF_DATA_NODES, response.numberOfDataNodes());
|
||||
builder.field(Fields.ACTIVE_PRIMARY_SHARDS, response.activePrimaryShards());
|
||||
builder.field(Fields.ACTIVE_SHARDS, response.activeShards());
|
||||
builder.field(Fields.RELOCATING_SHARDS, response.relocatingShards());
|
||||
|
@ -191,6 +192,7 @@ public class RestClusterHealthAction extends BaseRestHandler {
|
|||
static final XContentBuilderString NUMBER_OF_SHARDS = new XContentBuilderString("number_of_shards");
|
||||
static final XContentBuilderString NUMBER_OF_REPLICAS = new XContentBuilderString("number_of_replicas");
|
||||
static final XContentBuilderString NUMBER_OF_NODES = new XContentBuilderString("number_of_nodes");
|
||||
static final XContentBuilderString NUMBER_OF_DATA_NODES = new XContentBuilderString("number_of_data_nodes");
|
||||
static final XContentBuilderString ACTIVE_PRIMARY_SHARDS = new XContentBuilderString("active_primary_shards");
|
||||
static final XContentBuilderString ACTIVE_SHARDS = new XContentBuilderString("active_shards");
|
||||
static final XContentBuilderString RELOCATING_SHARDS = new XContentBuilderString("relocating_shards");
|
||||
|
|
Loading…
Reference in New Issue