分享

dfs、yarn和hbase启动后,jps只有一下六项,eclipse中编写程序无法在hbase中建立表

QQ图片20160306221839.png
大家好,我是新手,我是在Windows下运行的start-dfs.cmd start-yarn.cmd 和start-hbase.cmd,我的hbase-site.xml如下:
<configuration>
    <property>  
        <name>hbase.rootdir</name>  
        <value>hdfs://localhost:9000/hbase</value>  
    </property>
</configuration>
而且启动java也无法联接
这是我的代码,创建一个表:
public class Hbase {
        public static void main(String args[]) throws Exception{
                createTable();       
        }
        public static void createTable() throws IOException{
    Configuration conf=HBaseConfiguration.create();
        //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"));
        if(hBaseAdmin.tableExists("test")){
                System.out.println("table is exists !");
                System.exit(0);
        }else{
                hBaseAdmin.createTable(desc);
                System.out.println("成功创建表!");
        }
        }


以下是出现的问题:
2016-03-06 23:00:31,519 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
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2016-03-06 23:00:34,416 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
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)



已有(7)人评论

跳转到指定楼层
wscl1213 发表于 2016-3-7 07:37:09
如果是测试环境,可以取消hadoop hdfs的用户权限检查。打开conf/hdfs-site.xml,找到dfs.permissions属性修改为false(默认为true)OK了。(1.2.1 版本只有这个方法可行),如何操作可以参考第一个问题。







如果这里不行的话,就是防火墙等原因了
回复

使用道具 举报

小屁孩儿 发表于 2016-3-7 08:35:36
wscl1213 发表于 2016-3-7 07:37
如果是测试环境,可以取消hadoop hdfs的用户权限检查。打开conf/hdfs-site.xml,找到dfs.permissions属性修 ...

QQ图片20160307082925.jpg
你好,这个地方已经改过了,防火墙要怎么设置呢?
回复

使用道具 举报

小屁孩儿 发表于 2016-3-7 08:42:37
wscl1213 发表于 2016-3-7 07:37
如果是测试环境,可以取消hadoop hdfs的用户权限检查。打开conf/hdfs-site.xml,找到dfs.permissions属性修 ...

QQ图片20160307083656.png
我在cmd中可以运行hbase shell,但是java中连接不上,请问是怎么回事,这个问题困扰了我好几天......
回复

使用道具 举报

小屁孩儿 发表于 2016-3-7 08:53:59
wscl1213 发表于 2016-3-7 07:37
如果是测试环境,可以取消hadoop hdfs的用户权限检查。打开conf/hdfs-site.xml,找到dfs.permissions属性修 ...

目前我希望能够在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);时,就无法继续了
回复

使用道具 举报

wscl1213 发表于 2016-3-7 10:09:17
小屁孩儿 发表于 2016-3-7 08:53
目前我希望能够在java中对hbase进行操作,刚才修改了一下代码:
public class Hbase {
        public static  ...

java.net.UnknownHostException: master
master不识别,换成ip

回复

使用道具 举报

小屁孩儿 发表于 2016-3-7 17:03:53
wscl1213 发表于 2016-3-7 10:09
java.net.UnknownHostException: master
master不识别,换成ip

已经解决了,最终根本原因是VMware没有禁用!谢谢了!

点评

没有禁用??  发表于 2016-3-8 11:59
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条