Search code examples
apache-sparkhbaseapache-zookeeper

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


I am trying to connect spark application with hbase. Below is the configuration I am giving

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)

and below are the 'jps' details:

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

I have alsotried with hbase master 16010

I am getting below error:

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


Solution

  • Looks like there is a problem to join zookeeper. Check first that zookeeper is started on your local host on port 2181.

    netstat -tunelp | grep 2181 | grep -i LISTEN
    
     tcp6       0      0 :::2181                 :::*                    LISTEN 
    

    In your conf, in hbase.zookeeper.quorum property you have to pass the ip of your zookeeper and not the port (hbase.zookeeper.property.clientPort)

    My hbase connector is build with :

    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)