欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

hbase example code

程序员文章站 2023-12-28 09:57:10
...

本地连接hbase:

Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "localhost");
config.set("hbase.zookeeper.property.clientPort", "2181");
HBaseAdmin.checkHBaseAvailable(config);
HTable table = new HTable(config, "mytable");
System.out.println("Table testTable obtained!");

 

线上连接hbase:

config = HBaseConfiguration.create();
config.set("hbase.hbase.zookeeper.quorum", "192.168.1.1,192.168.1.2,192.168.1.3");
config.set("hbase.hbase.zookeeper.property.clientPort", "3325");
config.set("hbase.rpc.timeout", "60000");
config.set("hbase.client.retries.number", "3");
config.set("hbase.client.pause", "100");
config.set("hbase.rpc.timeout", "900000");
config.set("hbase.client.operation.timeout", "900000");
config.set("hbase.regionserver.lease.period", "900000");

 

 

上一篇:

下一篇: