我想获取特定区域服务器上所有区域的区域指标。特别是,我在 readRequestsCount 和 writeRequestsCount 之后。我在区域服务器 Web 界面中看到了这些值,但我无法找到对这些值的 API 访问。
问问题
736 次
2 回答
3
于 2013-07-02T01:17:28.513 回答
3
我在 Scala 中的解决方案的关键:
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
}
}
于 2013-07-02T18:42:19.883 回答