如何解决Hbase中的"zookeeper.ClientCnxn Connection refused"问题?

How to solve "zookeeper.ClientCnxn Connection refused" problem in Hbase?

Hbase 版本是 2.2.0,它 运行 在 Ubuntu 16.04 LTS 中。

当我在独立模式下使用 Hbase 时,实际上在其他任何模式下,我都会遇到一些 "Connection refused" 错误,如下所示

2019-06-22 00:28:12,804 INFO  [main-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2019-06-22 00:28:12,804 WARN  [main-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Session 0x16b7adc2ad80001 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:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)

它总是一次又一次地重复。

我的hbase-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>

     <property>
       <name>hbase.rootdir</name>
       <value>file:///usr/local/hbase/tmp/data</value>
     </property>

     <property>
       <name>hbase.cluster.distributed</name>
       <value>false</value>
     </property>

</configuration>

和 'hbase-env.sh' 我刚刚配置的文件 JAVA_HOMEHBASE_MANAGES_ZK:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HBASE_MANAGES_ZK=true

我找不到我的配置错误。当我键入 start-hbase.sh 命令时,当我键入 'jps' 命令时,我可以看到 "Hbase DATA in Hbase home" 和 HMaster 已经 运行ning。

但是,当我输入 hbase shell 时,我无法连接。

我在master-log中找不到任何解决方法,因为它总是重复"Connection refused"。

我想不通问题出在哪里。

我已经解决了这个问题。具体原因是我的'hbase'库依赖'hadoop',版本2.8.5,而我部署的'hadoop'版本是3.1.0。所以导致 'hflush/hsync' of 'hbase' 不受支持。

解决方案是here