2013-07-01 66 views
1

我想要獲取特定區域服務器上所有區域的區域度量標準。特別是,我在readRequestsCount和writeRequestsCount之後。我在地區服務器Web界面中看到這些值,但我無法找到對這些值的API訪問權限。用於獲取HBase區域度量標準的API

回答

2

我的解決方案在斯卡拉的癥結:

val config = new Configuration() 
config.set("hbase.zookeeper.quorum", /* put your own entry here */) 

val admin = new HBaseAdmin(config) 
val master = admin.getMaster 
val servers = master.getClusterStatus.getServers 

for(server <- servers){ 
    val load = master.getClusterStatus.getLoad(server) 
    val rloads = load.getRegionsLoad 
    for ((k,rload) <- rloads){ 

    // Do whatever you please with these values 
    var region = Bytes.toString(k) 
    val host = server.getHostname 
    val reads = rload.getReadRequestsCount 
    val writes = rload.getWriteRequestsCount 
    } 
}