Java Code Examples for org.apache.hadoop.hbase.client.HBaseAdmin#getClusterStatus()
The following examples show how to use
org.apache.hadoop.hbase.client.HBaseAdmin#getClusterStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { ServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example 2
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { ServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example 3
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { ServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example 4
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { ServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example 5
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { HServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], HServerLoad.RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example 6
Source File: HBaseRegionSizeCalculator.java From Kylin with Apache License 2.0 | 4 votes |
/** Constructor for unit testing */ HBaseRegionSizeCalculator(HTable table, HBaseAdmin hBaseAdmin) throws IOException { try { if (!enabled(table.getConfiguration())) { logger.info("Region size calculation disabled."); return; } logger.info("Calculating region sizes for table \"" + new String(table.getTableName()) + "\"."); // Get regions for table. Set<HRegionInfo> tableRegionInfos = table.getRegionLocations().keySet(); Set<byte[]> tableRegions = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR); for (HRegionInfo regionInfo : tableRegionInfos) { tableRegions.add(regionInfo.getRegionName()); } ClusterStatus clusterStatus = hBaseAdmin.getClusterStatus(); Collection<ServerName> servers = clusterStatus.getServers(); final long megaByte = 1024L * 1024L; // Iterate all cluster regions, filter regions from our table and // compute their size. for (ServerName serverName : servers) { ServerLoad serverLoad = clusterStatus.getLoad(serverName); for (RegionLoad regionLoad : serverLoad.getRegionsLoad().values()) { byte[] regionId = regionLoad.getName(); if (tableRegions.contains(regionId)) { long regionSizeBytes = regionLoad.getStorefileSizeMB() * megaByte; sizeMap.put(regionId, regionSizeBytes); // logger.info("Region " + regionLoad.getNameAsString() // + " has size " + regionSizeBytes); } } } } finally { hBaseAdmin.close(); } }