wscl1213 发表于 2016-3-7 10:09 已经解决了,最终根本原因是VMware没有禁用!谢谢了! |
小屁孩儿 发表于 2016-3-7 08:53 java.net.UnknownHostException: master master不识别,换成ip |
wscl1213 发表于 2016-3-7 07:37 目前我希望能够在java中对hbase进行操作,刚才修改了一下代码: public class Hbase { public static void main(String args[]) throws Exception{ createTable(); } public static void createTable() throws IOException{ Configuration conf=HBaseConfiguration.create(); conf.set("hbase.zookeeper.quorum", "master"); conf.set("hbase.zookeeper.property.clientPort", "2181"); //Connection conn= ConnectionFactory.createConnection(conf); HBaseAdmin hBaseAdmin = new HBaseAdmin(conf); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("test")); desc.addFamily(new HColumnDescriptor("test_1")); desc.addFamily(new HColumnDescriptor("test_2")); desc.addFamily(new HColumnDescriptor("test_3")); hBaseAdmin.createTable(desc); System.out.println("成功创建表!"); hBaseAdmin.close(); } } 出现这个问题: 2016-03-07 08:46:17,535 WARN [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Unable to create ZooKeeper Connection java.net.UnknownHostException: master at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:61) at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:445) at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:380) at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.checkZk(RecoverableZooKeeper.java:141) at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists(RecoverableZooKeeper.java:221) at org.apache.hadoop.hbase.zookeeper.ZKUtil.checkExists(ZKUtil.java:417) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.checkIfBaseNodeAvailable(HConnectionManager.java:942) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.access$600(HConnectionManager.java:604) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$StubMaker.makeStubNoRetries(HConnectionManager.java:1680) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$StubMaker.makeStub(HConnectionManager.java:1726) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$MasterServiceStubMaker.makeStub(HConnectionManager.java:1780) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getKeepAliveMasterService(HConnectionManager.java:1985) at org.apache.hadoop.hbase.client.HBaseAdmin$MasterCallable.prepare(HBaseAdmin.java:3452) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:114) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:91) at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:3479) at org.apache.hadoop.hbase.client.HBaseAdmin.createTableAsync(HBaseAdmin.java:629) at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:520) at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:454) at hbase.Hbase.createTable(Hbase.java:38) at hbase.Hbase.main(Hbase.java:23) 运行到这一句HBaseAdmin hBaseAdmin = new HBaseAdmin(conf);时,就无法继续了 |
如果是测试环境,可以取消hadoop hdfs的用户权限检查。打开conf/hdfs-site.xml,找到dfs.permissions属性修改为false(默认为true)OK了。(1.2.1 版本只有这个方法可行),如何操作可以参考第一个问题。 如果这里不行的话,就是防火墙等原因了 |