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");