读书人

hbase实现count效能

发布时间: 2013-12-28 22:19:33 作者: rapoo

hbase实现count功能
Scan scan = new Scan();scan.addFamily(Bytes.toBytes("cf"));scan.setCaching(500);AggregationClient ac = new AggregationClient(config);long rowCount = ac.rowCount(Bytes.toBytes("eagleeye-log"), new LongColumnInterpreter(), scan);System.out.println(rowCount);

?config初始化

config = HBaseConfiguration.create();Properties properties = ConfigUtils.readConfig(configFileName);for (String key : properties.stringPropertyNames()) {if (key.startsWith("config.hbase.")) {String hbaseKey = key.substring("config.hbase.".length());String value = properties.getProperty(key);config.set(hbaseKey, value);}}

?

参考:http://www.binospace.com/index.php/make-your-hbase-better-2/

读书人网 >其他相关

热点推荐