hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Asaf Mesika <asaf.mes...@gmail.com>
Subject Re: Hbase Region Size
Date Tue, 03 Dec 2013 05:55:47 GMT
In this method, you can get the region's Load per region:

    private Map<String, RegionLoad> getRegionsLoad() {
        try {
            Map<String, RegionLoad> regionsNameToLoad = new HashMap<String,
RegionLoad>();
            ClusterStatus clusterStatus = hAdmin.getClusterStatus();
            for (ServerName serverName : clusterStatus.getServers()) {
                HServerLoad load = clusterStatus.getLoad(serverName);
                Map<byte[], RegionLoad> regionsLoad = load.getRegionsLoad();
                for (Map.Entry<byte[], RegionLoad> entry :
regionsLoad.entrySet()) {
                    RegionLoad regionLoad = entry.getValue();
                    regionsNameToLoad.put(regionLoad.getNameAsString(),
regionLoad);
                }
            }
            return regionsNameToLoad;
        } catch (IOException e1) {
            throw new RuntimeException("Failed while fetching cluster load:
"+e1.getMessage(), e1);
        }
    }

Then you get use it by:

regionLoad.getStorefileSizeMB()

and there are other methds on RegionLoad.

Check it out.


Asaf


On Mon, Dec 2, 2013 at 3:48 PM, Vineet Mishra <clearmidoubt@gmail.com>wrote:

> Hi
>
> Can Anyone tell me the Java API for getting the Region Size of a table!
>
> Thanks!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message