use of org.apache.hadoop.hbase.ClusterStatus in project hbase by apache.
the class BaseTestHBaseFsck method getDeployedHRIs.
/**
* Get region info from local cluster.
*/
Map<ServerName, List<String>> getDeployedHRIs(final Admin admin) throws IOException {
ClusterStatus status = admin.getClusterStatus();
Collection<ServerName> regionServers = status.getServers();
Map<ServerName, List<String>> mm = new HashMap<>();
for (ServerName hsi : regionServers) {
AdminProtos.AdminService.BlockingInterface server = connection.getAdmin(hsi);
// list all online regions from this region server
List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(server);
List<String> regionNames = new ArrayList<>(regions.size());
for (HRegionInfo hri : regions) {
regionNames.add(hri.getRegionNameAsString());
}
mm.put(hsi, regionNames);
}
return mm;
}
use of org.apache.hadoop.hbase.ClusterStatus in project cdap by caskdata.
the class HBaseInfo method collect.
@Override
public synchronized void collect() throws IOException {
try (HBaseAdmin admin = new HBaseAdmin(conf)) {
ClusterStatus clusterStatus = admin.getClusterStatus();
ServerName master = clusterStatus.getMaster();
String protocol = conf.getBoolean("hbase.ssl.enabled", false) && conf.get("hbase.http.policy").equals("HTTPS_ONLY") ? "https" : "http";
webUrl = String.format("%s://%s:%s", protocol, master.getHostname(), conf.get("hbase.master.info.port"));
logsUrl = webUrl + "/logs";
}
}
use of org.apache.hadoop.hbase.ClusterStatus in project cdap by caskdata.
the class HBaseLoad method collect.
@Override
public void collect() throws IOException {
try (HBaseAdmin admin = new HBaseAdmin(conf)) {
ClusterStatus clusterStatus = admin.getClusterStatus();
regions = clusterStatus.getRegionsCount();
regionsInTransition = clusterStatus.getRegionsInTransition().size();
averageLoad = clusterStatus.getAverageLoad();
requests = clusterStatus.getRequestsCount();
}
}
use of org.apache.hadoop.hbase.ClusterStatus in project cdap by caskdata.
the class HBaseNodes method collect.
@Override
public synchronized void collect() throws IOException {
try (HBaseAdmin admin = new HBaseAdmin(conf)) {
ClusterStatus clusterStatus = admin.getClusterStatus();
// 1 master + number of backup masters
masters = 1 + clusterStatus.getBackupMastersSize();
regionServers = clusterStatus.getServersSize();
deadRegionServers = clusterStatus.getDeadServers();
}
}
use of org.apache.hadoop.hbase.ClusterStatus in project hbase by apache.
the class ClusterStatusPublisher method chore.
@Override
protected void chore() {
if (!connected) {
return;
}
List<ServerName> sns = generateDeadServersListToSend();
if (sns.isEmpty()) {
// Nothing to send. Done.
return;
}
final long curTime = EnvironmentEdgeManager.currentTime();
if (lastMessageTime > curTime - messagePeriod) {
// We already sent something less than 10 second ago. Done.
return;
}
// Ok, we're going to send something then.
lastMessageTime = curTime;
// We're reusing an existing protobuf message, but we don't send everything.
// This could be extended in the future, for example if we want to send stuff like the
// hbase:meta server name.
ClusterStatus cs = new ClusterStatus(VersionInfo.getVersion(), master.getMasterFileSystem().getClusterId().toString(), null, sns, master.getServerName(), null, null, null, null);
publisher.publish(cs);
}
Aggregations