看起来我可以像这样得到中键:
RegionServerServices rss = null;
final List<Region> onlineRegions = rss.getOnlineRegions(tableName);
for (Region region : onlineRegions) {
final List<Store> stores = region.getStores();
for (Store store : stores) {
final long storeSize = store.getSize();
final byte[] splitPoint = store.getSplitPoint();
}
}
}
}
但是,我无法在客户端获得HRegion
或Region
或RegionServerService
。
答案 0 :(得分:0)
免责声明:我不确定这种方法有多安全,因为它可能会对hfile进行读锁定。我打算尝试在快照上使用它,这样我就可以了。
您也可以:
原谅格式......
try (Connection connection =
ConnectionFactory.createConnection(hbaseConfig);
Admin admin = connection.getAdmin();) {
final List<HRegionInfo> regionInfoList = admin.getTableRegions(tableName);
HRegionInfo regionInfo = regionInfoList.get(0);
final HRegion region = HRegion.openHRegion(hbaseConfig,
FileSystem.get(hbaseConfig),
new Path("/hbase"),
regionInfo,
table.getTableDescriptor(),
null,
null,
null);
List<Store> stores = region.getStores();
stores.get(0).getSplitPoint();
}