Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How do I connect to HBase on Sandbox VM from host computer?

Solved Go to solution

How do I connect to HBase on Sandbox VM from host computer?

New Contributor

I have setup the HDP Sandbox 2.3.2 under VirtualBox running on my Mac. I am able to interact with HBase from inside the VM without any problem. However, when I try to connect via Java from my host, the connection fails. I have forwarded port 16000 and created a "sandbox.hortonworks.com" entry in /etc/hosts (similar to this post). Here is my Java code:

    Configuration conf = HBaseConfiguration.create();
    conf.set("fs.defaultFS", "hdfs://127.0.0.1:8020/");
    conf.set("hbase.zookeeper.property.clientPort", "2181");
    conf.set("hbase.zookeeper.quorum", "sandbox.hortonworks.com");
    conf.set("zookeeper.znode.parent", "/hbase-unsecure");
    HBaseAdmin.checkHBaseAvailable(conf);

Update:

A more helpful exception than the one below:

Master is not running: org.apache.hadoop.hbase.MasterNotRunningException: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.

Not sure why '/hbase' is being used, when I set "zookeeper.znode.parent" to "/hbase-unsecure" explicitly!

Update #2:

Running the code on the Sandbox gives exactly the same error. Any help?

Old: and I get this exception:

org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Call to sandbox.hortonworks.com/127.0.0.1:16000 failed on local exception: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to sandbox.hortonworks.com/127.0.0.1:16000 is closing. Call id=0, waitTime=47
	at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1533)
<snip>

Any suggestions or help? Why would HBase be closing my connection?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How do I connect to HBase on Sandbox VM from host computer?

Guru

Instead of specifying the config options, you should ALWAYS copy the /etc/hbase/conf folder and add that to your application classpath so that hbase-site.xml gets picked up from the classpath. See https://community.hortonworks.com/articles/4091/hbase-client-application-best-practices.html.

The other thing is that you should open up other ports, 16000, 16030, 16010, 16020, 2181. See http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0-Win/bk_HDP_Install_Win/content/ref-79239257-....

4 REPLIES 4
Highlighted

Re: How do I connect to HBase on Sandbox VM from host computer?

Guru

Instead of specifying the config options, you should ALWAYS copy the /etc/hbase/conf folder and add that to your application classpath so that hbase-site.xml gets picked up from the classpath. See https://community.hortonworks.com/articles/4091/hbase-client-application-best-practices.html.

The other thing is that you should open up other ports, 16000, 16030, 16010, 16020, 2181. See http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0-Win/bk_HDP_Install_Win/content/ref-79239257-....

Re: How do I connect to HBase on Sandbox VM from host computer?

New Contributor
@Enis

Thanks for the tip! Worked perfectly.

Re: How do I connect to HBase on Sandbox VM from host computer?

New Contributor

@Enis Thanks for the input. I am running into the same problem. But, I copied and added the hbase-site.xml to my mac host laptop. Are other file needed as well within (under like: /etc/hbase/conf/core-site.xml)And, now I am running into :

LOG of relevant properties set correctly:

conf.Configuration (Configuration.java:getConfResourceAsInputStream(2355)) - found resource hbase-site.xml at file:/etc/hbase/conf/hbase-site.xml 2016-09-27 12:21:22,651 INFO [main] hbasetest.ConnectHBase (ConnectHBase.java:main(61)) - hbase.zookeeper.quorum:/hbase-unsecure 2016-09-27 12:21:22,651 INFO [main] hbasetest.ConnectHBase (ConnectHBase.java:main(62)) - hbase.zookeeper.quorum:hdfs://sandbox.hortonworks.com:8020 2016-09-27 12:21:22,651 INFO [main] hbasetest.ConnectHBase (ConnectHBase.java:main(63)) - hbase.zookeeper.quorum:2181

Exception:

<code>

where applicable 2016-09-27 12:21:28,045 INFO [main] zookeeper.RecoverableZooKeeper (RecoverableZooKeeper.java:<init>(120)) - Process identifier=hconnection-0x22c86919 connecting to ZooKeeper ensemble=sandbox.hortonworks.com:2181 2016-09-27 12:21:31,461 INFO [main] client.ConnectionManager$HConnectionImplementation (ConnectionManager.java:closeZooKeeperWatcher(1682)) - Closing zookeeper sessionid=0x1569fdbdb97003f Exception in thread "main" org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.net.ConnectException: Connection refused at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1539) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionManager.java:1559) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getKeepAliveMasterService(ConnectionManager.java:1710) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.isMasterRunning(ConnectionManager.java:928) at org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:2877) at com.plantronics.data.storm.hbasetest.ConnectHBase.main(ConnectHBase.java:68) Caused by: com.google.protobuf.ServiceException: java.net.ConnectException: Connection refused at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:223) at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:287) at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$BlockingStub.isMasterRunning(MasterProtos.java:53657) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$MasterServiceStubMaker.isMasterRunning(ConnectionManager.java:1570) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStubNoRetries(ConnectionManager.java:1508) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1530) ... 5 more Caused by: java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupConnection(RpcClientImpl.java:410) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupIOstreams(RpcClientImpl.java:716) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.writeRequest(RpcClientImpl.java:887) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.tracedWriteRequest(RpcClientImpl.java:856) at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1200) at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:213) ... 10 more Disconnected from the target VM, address: '127.0.0.1:51389', transport: 'socket'

</code>

Wondering if this is port opening issue. Is there a horton help page similar to this for

Seeing a exception for connection opening here:

java.nio.channels.SocketChannel[connection-pending remote=sandbox.hortonworks.com/192.168.56.101:16000]

sandbox.hortonworks.com 16000 (Not able to connect here)

http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0-Win/bk_HDP_Install_Win/content/ref-79239257-....

for mac/linux?

Re: How do I connect to HBase on Sandbox VM from host computer?

@Daniel Hendrix

Make sure HBase is running. 16000 port is for ranger KMS so not whats the use of 16000 in this case.

Please follow this article for the java example setup

Don't have an account?
Coming from Hortonworks? Activate your account here