How connect to Hortonworks sandbox Hbase using Java Client API

Deadly 提交于 2019-12-12 18:53:10

问题


I have setup fresh Hortonworks sandbox .I'm trying to connect Hbase using Java Client API.This is the code i tried so far.But did not success.I did not change any configuration on Wortonworks sandbox.Do i need to do any configuration part in Hbase ?

        Configuration configuration = HBaseConfiguration.create();
        configuration.set("hbase.zookeeper.property.clientPort", "2181");
        configuration.set("hbase.zookeeper.quorum", "127.0.0.1");
        configuration.set("hbase.master", "127.0.0.1:600000");

        HBaseAdmin hBaseAdmin = new HBaseAdmin(configuration);

回答1:


This happened to me too. Here's how I solved it, More details here

I did this through editing VirtualBox’s Network settings. So there’s no need to modify any configuration files inside the Hortonworks sandbox VM such as the /etc/hosts file or the zoo.cfg file.

In VirtualBox, for the Hortonworks Sandbox VM:

  1. Stop the VM if it’s running

  2. Go to Settings -> Network, disable all current network adapters.

  3. Create a new Adapter, select Host-only Adapter, use the default settings and apply it.

  4. Start VM, ssh into it with root@192.168.56.101 (192.168.56.101 is the IP of the host-only adapter of the VM. I found it when I had two adapters enabled: NAT and host-only, ssh into the VM and run ifconfig. It seems to be the same for the same version of VM), start hbase through command line.

  5. In the machine’s hosts, add

192.168.56.101 hortonworks.hbase.vm 192.168.56.101 sandbox.hortonworks.com

Java Code I use

Configuration configuration = HBaseConfiguration.create();
configuration.set("hbase.zookeeper.property.clientPort", "2181");
configuration.set("hbase.zookeeper.quorum", "hortonworks.hbase.vm");
configuration.set("zookeeper.znode.parent", "/hbase-unsecure");


来源:https://stackoverflow.com/questions/25598859/how-connect-to-hortonworks-sandbox-hbase-using-java-client-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!