看尚硅谷视频,在windows上运行集群上的hbase时
package org.example;
import org.apache.hadoop.hbase.HbaseConfiguration;
import org.apache.hadoop.hbase.client.HbaseAdmin;
import java.io.IOException;
public class TestHbaseApi {
private static HbaseConfiguration conf;
private static HbaseAdmin admin;
public static void conncet2Hbase() throws IOException {
conf=new HbaseConfiguration();
conf.set("hbase.zookeeper.quorum","node1,node2,node3");
admin=new HbaseAdmin(conf);
}
public static boolean isTableExist(String tableName) throws IOException {
boolean is;
is=admin.tableExists(tableName);
admin.close();
return is;
}
public static void main(String[] args) throws IOException {
conncet2Hbase();
String tableName="ORDER_INFO";
System.out.println(isTableExist(tableName));
}
}
出现了以下的错误,说找不到位置:
Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations
其实是windows不认识node1,node2,node3是什么意思,去windows的hosts文件夹下把 node1的ip 和node1做一个映射,跟linux上的hosts一样
C:WindowsSystem32driversetchosts,会出现不能编辑的问题,更改一下文件的权限就好了



