获取 /hbase/hbaseid 失败,代码 = CONNECTIONLOSS,重试 = 6

failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 6

我正在尝试将 spark 应用程序与 hbase 连接起来。下面是我给出的配置

val conf = HBaseConfiguration.create()

conf.set("hbase.master", "localhost:16010")
conf.setInt("timeout", 120000)
conf.set("hbase.zookeeper.quorum", "2181")
val connection = ConnectionFactory.createConnection(conf)

以下是 'jps' 详细信息:

5808 ResourceManager
8150 HMaster
8280 HRegionServer
5131 NameNode
8076 HQuorumPeer
5582 SecondaryNameNode
2798 org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
8623 Jps
5951 NodeManager
5279 DataNode

我也试过 hbase master 16010

我遇到以下错误:

19/09/12 21:49:00 WARN ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Invalid argument
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Net.java:454)
    at sun.nio.ch.Net.connect(Net.java:446)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
    at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
    at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
    at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1024)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1060)
19/09/12 21:49:00 WARN ReadOnlyZKClient: 0x1e3ff233 to 2181:2181 failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 4
19/09/12 21:49:01 INFO ClientCnxn: Opening socket connection to server 2181/0.0.8.133:2181. Will not attempt to authenticate using SASL (unknown error)
19/09/12 21:49:01 ERROR ClientCnxnSocketNIO: Unable to open socket to 2181/0.0.8.133:2181

加入 zookeeper 似乎有问题。 首先检查 zookeeper 是否已在您的本地主机上的端口 2181 上启动。

netstat -tunelp | grep 2181 | grep -i LISTEN

 tcp6       0      0 :::2181                 :::*                    LISTEN 

在你的 conf 中,在 hbase.zookeeper.quorum 属性 你必须传递你的 zookeeper 的 ip 而不是端口 (hbase.zookeeper.property.clientPort)

我的 hbase 连接器是用 :

构建的
val conf = HBaseConfiguration.create()

      conf.set("hbase.zookeeper.quorum", "10.80.188.65")
      conf.set("hbase.master", "10.80.188.64:60000")
      conf.set("hbase.zookeeper.property.clientPort", "2181")
      conf.set("zookeeper.znode.parent", "/hbase-unsecure")

val connection = ConnectionFactory.createConnection(conf)