首页 > 技术文章 > HBase1.2.6 javaapi查看rowkey 所在分区等信息

sorco 2017-11-24 15:21 原文

Connection connection = HBaseFactory.getIns().getHbaseConn();
        RegionLocator r= connection.getRegionLocator(TableName.valueOf("mk"));
        HRegionLocation location = r.getRegionLocation(Bytes.toBytes("5800001511501"));
        HRegionInfo rg = location.getRegionInfo();
        String regionname = Bytes.toString(rg.getRegionName());
        String strkey = Bytes.toString(rg.getStartKey());
        String endkey = Bytes.toString(rg.getEndKey());

        System.out.println(regionname);
        System.out.println(strkey);
        System.out.println(endkey);

 

推荐阅读