HBase 未连接到 ZooKeeper

HBase not connecting to ZooKeeper

我正在努力获取我的 HBase shell 运行。 它在主题行中抛出上述异常。我已经检查过 hbase-site.xml 与 hadoop 完美匹配。

请帮忙。我挣扎了 2 天,有一个项目到期。我附上 hadoop 和 hbase 的两个 xml 文件。

hbase-site.xml

    <configuration>
      <property>
        <name>hbase.rootdir</name>    
        <value>hdfs://localhost:54310/hbase</value>
        </property>
     <property>
     <name>hbase.zookeeper.property.dataDir</name>
     <value>/home/hduser/zookeeper</value>
    </property>

    <property>
      <name>hbase.zookeeper.property.clientPort</name>
      <value>2222</value>
      <description>Property from ZooKeeper's config zoo.cfg.
      The port at which the clients will connect.
      </description>
    </property>

    <property>
      <name>hbase.zookeeper.quorum</name>
      <value>localhost</value>
      <description>Comma separated list of servers in the ZooKeeper Quorum.
      </description>
    </property>

    </configuration>

核心-site.xml

  <configuration>
    <property>
      <name>hadoop.tmp.dir</name>
      <value>/app/hadoop/tmp</value>
      <description>A base for other temporary directories.</description>
    </property>

    <property>
      <name>fs.default.name</name>
      <value>hdfs://localhost:54310</value>
      <description>The name of the default file system.</description>
    </property>    
  </configuration>

确保 zookeeper 在 2222 端口上 运行 并且应该在 zookeeper/conf/zoo.cfg

中输入
# the port at which the clients will connect
clientPort=2222

或者设为 2181,通过 ./zkServer.sh start 启动 zookeeper 并在 hbase-site.xml

中更改此默认端口
   <property>
      <name>hbase.zookeeper.property.clientPort</name>
      <value>2181</value>
   </property>