HBase 独立版无法连接(无法创建表)

2022-09-02 04:25:30

我正在尝试在本文之后以独立模式部署Hbase:http://hbase.apache.org/book.html#quickstart。版本为 0.92.1-cdh4.1.2

但是我在尝试创建表时遇到这些错误:

错误信息:

    13/04/01 14:07:10 ERROR zookeeper.RecoverableZooKeeper: ZooKeeper exists failed after 3 retries
13/04/01 14:07:10 WARN zookeeper.ZKUtil: hconnection Unable to set watcher on znode /hbase/master
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/master
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
    at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1021)
    at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists(RecoverableZooKeeper.java:154)
    at org.apache.hadoop.hbase.zookeeper.ZKUtil.watchAndCheckExists(ZKUtil.java:226)
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker.start(ZooKeeperNodeTracker.java:82)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.java:580)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:569)

输出日志:

13/04/01 14:06:39 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
13/04/01 14:06:39 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 10231@localhost
13/04/01 14:06:39 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
13/04/01 14:06:39 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
13/04/01 14:06:39 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid

我的配置:

  1. 在 hbase-env.sh 中添加JAVA_HOME
  2. hbase_site.xml

    <name>hbase.rootdir</name>
    
    <value>file:///home/hadoop/data</value>
    

    <name>hbase.zookeeper.property.dataDir</name>
    
    <value>file:///home/hadoop/zookeeper</value>
    

我试图修改/etc/hosts,它看起来像这样(oracle是主机名):

127.0.0.1   localhost oracle

[server ip]   localhost oracle

但这些对我不起作用。

我的确切代码是:

[usr@oracle bin]$ ./start-hbase.sh 
starting master, logging to /home/hadoop/hbase-0.94.6/bin/../logs/hbase-usr-master-oracle.out
[usr@oracle bin]$ hbase shell
13/04/01 14:57:55 WARN conf.Configuration: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.92.1-cdh4.1.2, rUnknown, Thu Nov  1 18:02:07 PDT 2012

hbase(main):001:0> create 'test','cf'

提前致谢!


答案 1

您的配置中似乎缺少您。请查看此HBase指南章节,它可能会有所帮助:http://hbase.apache.org/book/zookeeper.htmlhbase.zookeeper.quorum

另外,请检查 Zookeeper 是否在正确的端口上启动,以及(更常见的情况)正确的 IP 接口。


答案 2

我不确定你是否在Mac上,但我也有这个问题。事实证明,这是因为.DS_STORE文件位于 -ROOT- 区域服务器的文件夹中,并导致连接异常。很奇怪!


推荐