Search in sources :

Example 6 with ClusterStatus

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) ServerName(org.apache.hadoop.hbase.ServerName) List(java.util.List) ArrayList(java.util.ArrayList) ClusterStatus(org.apache.hadoop.hbase.ClusterStatus)

Example 7 with ClusterStatus

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";
    }
}
Also used : HBaseAdmin(org.apache.hadoop.hbase.client.HBaseAdmin) ServerName(org.apache.hadoop.hbase.ServerName) ClusterStatus(org.apache.hadoop.hbase.ClusterStatus)

Example 8 with ClusterStatus

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();
    }
}
Also used : HBaseAdmin(org.apache.hadoop.hbase.client.HBaseAdmin) ClusterStatus(org.apache.hadoop.hbase.ClusterStatus)

Example 9 with ClusterStatus

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();
    }
}
Also used : HBaseAdmin(org.apache.hadoop.hbase.client.HBaseAdmin) ClusterStatus(org.apache.hadoop.hbase.ClusterStatus)

Example 10 with ClusterStatus

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);
}
Also used : ServerName(org.apache.hadoop.hbase.ServerName) ClusterStatus(org.apache.hadoop.hbase.ClusterStatus)

Aggregations

ClusterStatus (org.apache.hadoop.hbase.ClusterStatus)23 ServerName (org.apache.hadoop.hbase.ServerName)19 ServerLoad (org.apache.hadoop.hbase.ServerLoad)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 RegionLoad (org.apache.hadoop.hbase.RegionLoad)4 HBaseTestingUtility (org.apache.hadoop.hbase.HBaseTestingUtility)3 MiniHBaseCluster (org.apache.hadoop.hbase.MiniHBaseCluster)3 HBaseAdmin (org.apache.hadoop.hbase.client.HBaseAdmin)3 IOException (java.io.IOException)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 TreeMap (java.util.TreeMap)2 TableName (org.apache.hadoop.hbase.TableName)2 Admin (org.apache.hadoop.hbase.client.Admin)2 RegionState (org.apache.hadoop.hbase.master.RegionState)2 ByteString (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString)2 LiveServerInfo (org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.LiveServerInfo)2 RegionInTransition (org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionInTransition)2 MasterThread (org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread)2