Support Questions
Find answers, ask questions, and share your expertise

HBase connection issue from java

Highlighted

HBase connection issue from java

Rising Star

I am getting below error from from client machine (outside Hadoop cluster) when trying to access Hbase from java api

Mon Feb 06 15:40:51 IST 2017, RpcRetryingCaller{globalStartTime=1486374714593, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.MasterNotRunningException: Can't get connection to ZooKeeper: KeeperErrorCode = ConnectionLoss for /hbase-unsecure
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:147)
        at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:3917)
        at org.apache.hadoop.hbase.client.HBaseAdmin.listTableNames(HBaseAdmin.java:413)
        at org.apache.hadoop.hbase.client.HBaseAdmin.listTableNames(HBaseAdmin.java:397)
        at com.bigframe.hbase.api.HDInsightHbase.main(HDInsightHbase.java:43)
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.MasterNotRunningException: Can't get connection to ZooKeeper: KeeperErrorCode = ConnectionLoss for /hbase-unsecure
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1533)
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionManager.java:1553)
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getKeepAliveMasterService(ConnectionManager.java:1704)
        at org.apache.hadoop.hbase.client.MasterCallable.prepare(MasterCallable.java:38)
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:124)
        ... 4 more
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: Can't get connection to ZooKeeper: KeeperErrorCode = ConnectionLoss for /hbase-unsecure
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.checkIfBaseNodeAvailable(ConnectionManager.java:906)
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.access$400(ConnectionManager.java:545)
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStubNoRetries(ConnectionManager.java:1483)
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1524)
        ... 8 more
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase-unsecure
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
        at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1045)
        at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists(RecoverableZooKeeper.java:221)
        at org.apache.hadoop.hbase.zookeeper.ZKUtil.checkExists(ZKUtil.java:541)
        at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.checkIfBaseNodeAvailable(ConnectionManager.java:895)
        ... 11 more

MY code snapshot is below

 Configuration config = HBaseConfiguration.create();
 config.set("hbase.zookeeper.quorum", "zookeepernode0,zookeepernode1,zookeepernode2");    
 config.set("hbase.zookeeper.property.clientPort", "2181");
 config.set("hbase.cluster.distributed", "true");
 config.set("zookeeper.znode.parent","/hbase-unsecure");
 HBaseAdmin admin = new HBaseAdmin(config);
 TableName[] tm = admin.listTableNames();
 for(int i = 0; i<tm.length;i++){
System.out.println(tm[i].getNameAsString());
  }

Same code is running fine from inside hadoop cluster . Should I raise firewall request for hbase.zookeeper.quorum nodes from client machine ? Please help. This is urgent.

8 REPLIES 8
Highlighted

Re: HBase connection issue from java

Mentor

Yes make sure ports are open for zookeeper and hbase for your client machine

Re: HBase connection issue from java

Rising Star

@Artem Ervits

Thanks for your quick reply . How can I check this ? using telnet ? I am running below command from client machine

telnet zookeepernode0 2181

I am getting below error

telnet: Unable to connect to remote host: Connection refused

Please suggest.

Highlighted

Re: HBase connection issue from java

Connection refused means that your client cannot connect to the port on that host. That means there is either no port open on that machine or something is preventing you from connecting to it.

If there is a firewall in place like you alluded to, it sounds like you need to talk to your system administrators. We can't fix that for you..

Highlighted

Re: HBase connection issue from java

Rising Star

@Josh Elser

I am using HDInsight cluster in cloud. is it possible to raise firewall request for cloud host/port?

Highlighted

Re: HBase connection issue from java

Rising Star

@Josh Elser

I am using HDInsight cluster in cloud. is it possible to raise firewall request for cloud host/port from local machine?

Highlighted

Re: HBase connection issue from java

Rising Star

@Artem Ervits

I am using HDInsight cluster in cloud. is it possible to raise firewall request for cloud host/port from local machine?

Highlighted

Re: HBase connection issue from java

Mentor

In Azure portal, you should be able to open endpoints for those ports. Not sure if same option is available in HDInsight, then just open a case with them and tell them to open zk and hbase for you.

Highlighted

Re: HBase connection issue from java

New Contributor

@Artem Ervits,
Zookeeper Ports are open for me, but I'm still facing the same exception