【问题标题】:Hbase Error "ERROR: KeeperErrorCode = NoNode for /hbase/master"Hbase 错误“错误:KeeperErrorCode = NoNode for /hbase/master”
【发布时间】:2021-12-22 11:40:48
【问题描述】:

在 hbase shell 中执行任何命令时,我在 hbase shell 中收到以下错误“ERROR: KeeperErrorCode = NoNode for /hbase/master”。

开始 HBASE:

    HOSTCHND:hbase-2.0.0 gvm$ ./bin/start-hbase.sh
    localhost: running zookeeper, logging to /usr/local/Cellar/hbase-2.0.0/bin/../logs/hbase-gvm-zookeeper-HOSTCHND.local.out
    running master, logging to /usr/local/Cellar/hbase-2.0.0/logs/hbase-gvm-master-HOSTCHND.local.out
    : running regionserver, logging to /usr/local/Cellar/hbase-2.0.0/logs/hbase-gvm-regionserver-HOSTCHND.local.out

在 HBASE SHELL 中检查状态时:

    hbase(main):001:0> status

    ERROR: KeeperErrorCode = NoNode for /hbase/master

    Show cluster status. Can be 'summary', 'simple', 'detailed', or 'replication'. The
    default is 'summary'. Examples:

    hbase> status
    hbase> status 'simple'
    hbase> status 'summary'
    hbase> status 'detailed'
    hbase> status 'replication'
    hbase> status 'replication', 'source'
    hbase> status 'replication', 'sink'

   Took 9.4096 seconds                                                             
   hbase(main):002:0> 

hbase-site.xml

<configuration>
<property>
    <name>hbase.rootdir</name>
    <value>hdfs://localhost:9000/hbase</value>
</property>
<property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
</property>
<property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/usr/local/Cellar/hbase-2.0.0/hbasestorage/zookeeper</value>
</property>
<property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
</property>
<property>
    <name>hbase.zookeeper.quorum</name>
    <value>localhost</value>
</property>
</configuration>

请告诉我为什么在执行 hbase 命令时会出现此错误?

【问题讨论】:

    标签: hadoop hbase hdfs apache-zookeeper


    【解决方案1】:

    在我的情况下,我收到此“ERROR: KeeperErrorCode = NoNode for /hbase/master”是因为 HMaster 进程没有运行。

    使用jps 命令检查。

    hdusr@hdp-master-1:$ jps
    27504 Main
    32755 DataNode
    23316 HQuorumPeer
    27957 Jps
    646 SecondaryNameNode
    27097 HMaster
    23609 HRegionServer
    1562 Master
    1722 Worker
    911 ResourceManager
    32559 NameNode
    1167 NodeManager
    

    如果您没有看到上述列表中的 HMaster 进程,那么这就是在 hbase shell 中出现ERROR: KeeperErrorCode = NoNode. 的原因。

    $HBASE_HOME/logs 目录中检查hbase-***-master.log 是否有特定错误。

    就我而言,有两个原因,

    第一:

    WARN  [main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
    java.net.ConnectException: Connection timed out
    

    我通过在 hbase-site.xml 中用“我的机器的主机名”替换“localhost”来解决这个问题。从这个answer

    第二:

        ERROR [master/spark-hdp-master-1:16000:becomeActiveMaster] master.HMaster: Failed to become active masterorg.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException): org.apache.hadoop.security.AccessControlException: SIMPLE authentication is not enabled.  Available:[TOKEN]
    

    这是因为hbase-site.xml中的hdfs端口与hadoop的core-site.xml中的不同。

    【讨论】:

      【解决方案2】:

      将这些配置替换或添加到hbase dir的conf文件夹中的hbase-site.xml文件中,然后重新运行“hbase shell”命令,再运行“list”命令查看存在的表。

      <?xml version="1.0" encoding="utf-8" ?>
      
      <!--Keeper Error fix-->
      <configuration>
          <property>
              <name>hbase.rootdir</name>
              <value>hdfs://localhost:8020/hbase</value>
          </property>
              <property>
              <name>hbase.zookeeper.quorum</name>
              <value>localhost</value>
          </property>
              <property>
              <name>hbase.zookeeper.property.clientPort</name>
              <value>2182</value>
          </property>
                  <property>
              <name>hbase.zookeeper.property.dataDir</name>
              <value>/var/lib/hbase/zookeeper</value>
          </property>
      </configuration>
      

      【讨论】:

        【解决方案3】:

        首先,确保在hosts文件中已经设置了IP和主机名映射。

        其次,修改HBase临时目录位置。临时目录数据将定期清空。临时目录的默认是在/tmp上,改在hbase-site.xml

        <property>
                <name>hbase.tmp.dir</name>
                <value>/hbase/tmp</value>
                <description>Temporary directory on the local filesystem.</description>
        </property>
        

        如果它不起作用。清理hbase数据目录,同时清理zookeeper中的元数据,再次重启hbase。

        此外,请检查您的 ntp 和防火墙。

        【讨论】:

        • 感谢您的回复。我创建了一个目录 /hbase/tmp 并在 hbase-site.xml 中配置了这个属性,我清理了两个数据,zookeeper 目录。但仍然收到相同的异常。
        • @user7413163 如果您需要更多帮助,请显示您的日志,而不仅仅是错误
        【解决方案4】:

        我知道这与 spark 无关,但我遇到了以下错误;

        原因:java.io.IOException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /hbase/meta-region-server

        原因:org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /hbase/meta-region-server

        原因:org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /hbase/hbasei

        设置 hbase.rootdir 配置解决了我在创建 HBaseContext 时遇到的问题;

        val config = HBaseConfiguration.create
        config.set("hbase.zookeeper.quorum", "addresses")
        config.setInt("hbase.zookeeper.property.clientPort", port)
        
        config.set("hbase.rootdir","/apps/hbase/data") // adding this one resolves my problems
        
        val hbaseContext = new HBaseContext(sc, config)
        

        所以您可以尝试将该配置添加到 hbase-site.xml 中。

        【讨论】:

          【解决方案5】:

          遇到了类似的问题:按照以下步骤操作

          人们也可能面临其他问题。在下面提到它们”

          1. 同时设置 zookeeper:https://www.tutorialspoint.com/zookeeper/zookeeper_installation.htm
          2. 可能会遇到权限问题,因此请将 chmod -R 777 分配给 /tmp/zookeeper、/usr/local/var/hbase、/usr/local/Cellar/hbase
          3. 在 bin/zoo.cfg 中添加 admin.enableServer=false 以避免地址绑定异常
          4. 尝试在不使用 sudo 的情况下同时运行 HBase 和 zookeeper。

          【讨论】:

            【解决方案6】:

            如果在 hbase 按预期运行时突然发生,没有任何关于错误的线索,然后尝试删除 hbase-tmp-dir (hbase.tmp.dir),删除 zookeeper 的元数据,然后重新启动 hbase 和 zookeeper 可能会有所帮助你。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2021-08-05
              • 2018-02-14
              • 1970-01-01
              • 2016-02-20
              • 2011-09-03
              相关资源
              最近更新 更多