import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
public class readRegion {
public static void main(String[] args) throws Exception {
readRegion tools = new readRegion();
}
@SuppressWarnings("deprecation")
public readRegion() {
Configuration hbase_config = HBaseConfiguration.create();
hbase_config
.set("hbase.zookeeper.quorum",
"11.11.11.11");
hbase_config.set("zookeeper.znode.parent", "/hbase");
hbase_config.set("hbase.rpc.timeout", "180000");
hbase_config.set("hbase.cluster.distributed", "true");
hbase_config.set("hbase.regionserver.lease.period", "180000");
try {
/*HBaseAdmin admin = new HBaseAdmin(hbase_config);
List<HRegionInfo> regions = admin.getTableRegions(" adfdinfo"
.getBytes());
for (HRegionInfo info : regions) {
System.out.println(info.getEncodedName());
}*/
HTable table = new HTable(hbase_config, "test_inaao");
String Row = "12321315351_20170718";
byte[] row = Bytes.toBytes(Row);
Get get = new Get(row);
Result result = table.get(get);
System.out.println(result);
} catch (Exception e) {
}
}
}
读hbase的region简单程序--67
最新推荐文章于 2022-04-22 19:35:29 发布