本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel.addDeadNode方法的典型用法代码示例。如果您正苦于以下问题:Java StorageClusterStatusModel.addDeadNode方法的具体用法?Java StorageClusterStatusModel.addDeadNode怎么用?Java StorageClusterStatusModel.addDeadNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel
的用法示例。
在下文中一共展示了StorageClusterStatusModel.addDeadNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
public Response get(final @Context UriInfo uriInfo) {
if (LOG.isDebugEnabled()) {
LOG.debug("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
try {
HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
ClusterStatus status = admin.getClusterStatus();
StorageClusterStatusModel model = new StorageClusterStatusModel();
model.setRegions(status.getRegionsCount());
model.setRequests(status.getRequestsCount());
model.setAverageLoad(status.getAverageLoad());
for (ServerName info: status.getServers()) {
HServerLoad load = status.getLoad(info);
StorageClusterStatusModel.Node node =
model.addLiveNode(
info.getHostname() + ":" +
Integer.toString(info.getPort()),
info.getStartcode(), load.getUsedHeapMB(),
load.getMaxHeapMB());
node.setRequests(load.getNumberOfRequests());
for (HServerLoad.RegionLoad region: load.getRegionsLoad().values()) {
node.addRegion(region.getName(), region.getStores(),
region.getStorefiles(), region.getStorefileSizeMB(),
region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB());
}
}
for (ServerName name: status.getDeadServerNames()) {
model.addDeadNode(name.toString());
}
ResponseBuilder response = Response.ok(model);
response.cacheControl(cacheControl);
return response.build();
} catch (IOException e) {
throw new WebApplicationException(e,
Response.Status.SERVICE_UNAVAILABLE);
}
}
示例2: get
import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
if (LOG.isDebugEnabled()) {
LOG.debug("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
try {
ClusterStatus status = servlet.getAdmin().getClusterStatus();
StorageClusterStatusModel model = new StorageClusterStatusModel();
model.setRegions(status.getRegionsCount());
model.setRequests(status.getRequestsCount());
model.setAverageLoad(status.getAverageLoad());
for (ServerName info: status.getServers()) {
ServerLoad load = status.getLoad(info);
StorageClusterStatusModel.Node node =
model.addLiveNode(
info.getHostname() + ":" +
Integer.toString(info.getPort()),
info.getStartcode(), load.getUsedHeapMB(),
load.getMaxHeapMB());
node.setRequests(load.getNumberOfRequests());
for (RegionLoad region: load.getRegionsLoad().values()) {
node.addRegion(region.getName(), region.getStores(),
region.getStorefiles(), region.getStorefileSizeMB(),
region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB(),
region.getReadRequestsCount(), region.getWriteRequestsCount(),
region.getRootIndexSizeKB(), region.getTotalStaticIndexSizeKB(),
region.getTotalStaticBloomSizeKB(), region.getTotalCompactingKVs(),
region.getCurrentCompactedKVs());
}
}
for (ServerName name: status.getDeadServerNames()) {
model.addDeadNode(name.toString());
}
ResponseBuilder response = Response.ok(model);
response.cacheControl(cacheControl);
servlet.getMetrics().incrementSucessfulGetRequests(1);
return response.build();
} catch (IOException e) {
servlet.getMetrics().incrementFailedGetRequests(1);
return Response.status(Response.Status.SERVICE_UNAVAILABLE)
.type(MIMETYPE_TEXT).entity("Unavailable" + CRLF)
.build();
}
}
示例3: get
import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
if (LOG.isDebugEnabled()) {
LOG.debug("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
try {
ClusterStatus status = servlet.getAdmin().getClusterStatus();
StorageClusterStatusModel model = new StorageClusterStatusModel();
model.setRegions(status.getRegionsCount());
model.setRequests(status.getRequestsCount());
model.setAverageLoad(status.getAverageLoad());
for (ServerName info: status.getServers()) {
HServerLoad load = status.getLoad(info);
StorageClusterStatusModel.Node node =
model.addLiveNode(
info.getHostname() + ":" +
Integer.toString(info.getPort()),
info.getStartcode(), load.getUsedHeapMB(),
load.getMaxHeapMB());
node.setRequests(load.getNumberOfRequests());
for (HServerLoad.RegionLoad region: load.getRegionsLoad().values()) {
node.addRegion(region.getName(), region.getStores(),
region.getStorefiles(), region.getStorefileSizeMB(),
region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB(),
region.getReadRequestsCount(), region.getWriteRequestsCount(),
region.getRootIndexSizeKB(), region.getTotalStaticIndexSizeKB(),
region.getTotalStaticBloomSizeKB(), region.getTotalCompactingKVs(),
region.getCurrentCompactedKVs());
}
}
for (ServerName name: status.getDeadServerNames()) {
model.addDeadNode(name.toString());
}
ResponseBuilder response = Response.ok(model);
response.cacheControl(cacheControl);
servlet.getMetrics().incrementSucessfulGetRequests(1);
return response.build();
} catch (IOException e) {
servlet.getMetrics().incrementFailedGetRequests(1);
return Response.status(Response.Status.SERVICE_UNAVAILABLE)
.type(MIMETYPE_TEXT).entity("Unavailable" + CRLF)
.build();
}
}
示例4: get
import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; //导入方法依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
if (LOG.isTraceEnabled()) {
LOG.trace("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
try {
ClusterMetrics status = servlet.getAdmin().getClusterMetrics(
EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS));
StorageClusterStatusModel model = new StorageClusterStatusModel();
model.setRegions(status.getRegionCount());
model.setRequests(status.getRequestCount());
model.setAverageLoad(status.getAverageLoad());
for (Map.Entry<ServerName, ServerMetrics> entry: status.getLiveServerMetrics().entrySet()) {
ServerName sn = entry.getKey();
ServerMetrics load = entry.getValue();
StorageClusterStatusModel.Node node =
model.addLiveNode(
sn.getHostname() + ":" +
Integer.toString(sn.getPort()),
sn.getStartcode(), (int) load.getUsedHeapSize().get(Size.Unit.MEGABYTE),
(int) load.getMaxHeapSize().get(Size.Unit.MEGABYTE));
node.setRequests(load.getRequestCount());
for (RegionMetrics region: load.getRegionMetrics().values()) {
node.addRegion(region.getRegionName(), region.getStoreCount(),
region.getStoreFileCount(),
(int) region.getStoreFileSize().get(Size.Unit.MEGABYTE),
(int) region.getMemStoreSize().get(Size.Unit.MEGABYTE),
(long) region.getStoreFileIndexSize().get(Size.Unit.KILOBYTE),
region.getReadRequestCount(),
region.getWriteRequestCount(),
(int) region.getStoreFileRootLevelIndexSize().get(Size.Unit.KILOBYTE),
(int) region.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE),
(int) region.getBloomFilterSize().get(Size.Unit.KILOBYTE),
region.getCompactingCellCount(),
region.getCompactedCellCount());
}
}
for (ServerName name: status.getDeadServerNames()) {
model.addDeadNode(name.toString());
}
ResponseBuilder response = Response.ok(model);
response.cacheControl(cacheControl);
servlet.getMetrics().incrementSucessfulGetRequests(1);
return response.build();
} catch (IOException e) {
servlet.getMetrics().incrementFailedGetRequests(1);
return Response.status(Response.Status.SERVICE_UNAVAILABLE)
.type(MIMETYPE_TEXT).entity("Unavailable" + CRLF)
.build();
}
}