Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Hbase Region Size


Copy link to this message
-
Re: Hbase Region Size
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 <[EMAIL PROTECTED]>wrote:

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