练习hbase的java api
来源:6-30 用户应用子系统 - 用户领取优惠券服务实现

qq_张黎明_2
2019-12-04
我想练习hbase的java api
请问下配置文件该如何配置?
我的配置文件:
data:
hbase:
quorum: 118.25.60.230:2181
rootDir: /home/softs/hbase/data
nodeParent: /hbase
测试类
public static Configuration conf = HBaseConfiguration.create();
@Test
public static void main(String[] args) throws Exception {
System.setProperty("hadoop.home.dir", "/home/hadoop");
HBaseAdmin hBaseAdmin = new HBaseAdmin(conf);
TableName[] tableNames = hBaseAdmin.listTableNames();
for (TableName tableName :
tableNames) {
System.out.println(tableName.toString());
}
}
但是连接不上,请求老师帮助
2回答
-
张勤一
2019-12-04
同学你好:
看打印的日志是 Windows 系统吧,路径格式肯定是不对的。可以搜下 Windows 上 Hbase 的运行方法。
欢迎来 QQ 群随时交流、讨论,也非常感谢同学的支持!
122019-12-04 -
qq_张黎明_2
提问者
2019-12-04
控制台一直报着几个错:
17:19:57.465 [main] DEBUG org.apache.hadoop.util.Shell - Failed to detect a valid hadoop home directory
java.io.IOException: Hadoop home directory \home\hadoop does not exist, is not a directory, or is not an absolute path.
17:19:57.465 [main] ERROR org.apache.hadoop.util.Shell - Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
17:19:59.208 [main-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
hbase和zookeeper我都起了!!!
00
相似问题