首页 > 代码库 > HBase client

HBase client

通过HBase client访问HBase时,配置如下:

Configuration conf = HBaseConfiguration.create();

// Zookeeper地址
conf.set(HConstants.ZOOKEEPER_QUORUM, "master.hadoop");

//Zookeeper端口
conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, "2181");

//Zookeeper节点父目录
conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/hbase-unsecure");
HBaseAdmin admin = new HBaseAdmin(conf);
boolean b = admin.tableExists("表名");
System.out.println(b);

配置准确的Zookeeper才能连接HBase