【Hbase】【CDH】hbase shell 登陆报错:: ZooKeeper exists failed after 4 attempt

时间:2024-10-02 07:29:30

前言

在Cloudera manager 环境中,给某一个client节点上添加一个新的hbase gateway。

但是也就是这个时候,在client节点上执行命令

[root@client ~]# hbase shell

提示文章标题的错误.

Description

在安装了hbase client上 gateway ,进行登陆hbase,发现以下报错:

  1. [root@client ~]# hbase shell
  2. 2020-06-09 16:36:59,057 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.
  3. 2020-06-09 16:37:17,368 ERROR [main] : ZooKeeper exists failed after 4 attempts
  4. 2020-06-09 16:37:17,369 WARN [main] : hconnection-0x7c8c70d60x0, quorum=localhost:2181, baseZNode=/hbase Unable to set watcher on znode (/hbase/hbaseid)
  5. $ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
  6. ....
  7. HBase Shell; enter 'help<RETURN>' for list of supported commands.
  8. Type "exit<RETURN>" to leave the HBase Shell
  9. Version 1.2.0-cdh5.11.2, rUnknown, Fri Aug 18 14:10:19 PDT 2017
  10. hbase(main):001:0> exit

ROOT CAUSE

原因是该hbase的 client链接的zk 一直是本地的zk,可以从报错当中看到:quorum=localhost:2181

  1. ...
  2. WARN [main] : hconnection-0x7c8c70d60x0, quorum=localhost:2181, baseZNode=/hbase Unable to set watcher on znode (/hbase/hbaseid)
  3. $ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
  4. ...

未能定位到具体的原因,在部署了hbase gateway之后,不能连接上集群的zk。而对应的另一台client hbase链接没有问题。

Solved

Workround:

文件当中指定zk的地址即可!

也即在路径/opt/cloudera/parcels/CDH/etc/hbase/ 下的 文件configuration属性下添加以下内容:

  1. <configuration>
  2. <property>
  3. <name></name>
  4. <value>,slave1.cluster,slave2.cluster</value>
  5. </property>
  6. </configuration>

ps: 对应的 是host 映射。

重试结果:

  1. [root@client ]# hbase shell
  2. 2020-06-09 16:54:27,731 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.
  3. HBase Shell; enter 'help<RETURN>' for list of supported commands.
  4. Type "exit<RETURN>" to leave the HBase Shell
  5. Version 1.2.0-cdh5.11.2, rUnknown, Fri Aug 18 14:10:19 PDT 2017
  6. hbase(main):001:0> list
  7. TABLE
  8. mx:mx_default_instance_23
  9. xiaoxiang_yu:xiaoxiang_4SWJU0FK8I
  10. 2 row(s) in 0.2290 seconds
  11. => ["default:default"]
  12. hbase(main):002:0>

成功!

本博客为博主原创,谢绝转载,谢谢!