ERROR hbase.HServerAddress: Could not resolve the DNS name of ubuntu118
Exception in thread "main" java.lang.IllegalArgumentException: hostname can't be null
at java.net.InetSocketAddress.<init>(InetSocketAddress.java:121)
at org.apache.hadoop.hbase.HServerAddress.getResolvedAddress(HServerAddress.java:108)
at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:64)
at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:561)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:99)
at com.biencloud.test.first_hbase.main(first_hbase.java:23)
这个问题说明运行eclipse的机器没有检测到运行hbase的机器的域名,运行eclipse的机器无论是在linux还是windows中,都需要将运行hbase的ip和机器名添加到系统配置文件中。
1 如果eclipse运行在linux中,添加配置具体如下:
nano /etc/hosts
在其中添加
192.168.0.118 ubuntu118
192.168.0.186 ubuntu186
192.168.0.182 ubuntu182
2 如果eclipse运行在windows中,添加配置如下:
进入C:WINDOWSsystem32driversetc,打开其中的hosts文件,在其中加入
192.168.0.118 ubuntu118
192.168.0.186 ubuntu186
192.168.0.182 ubuntu182