我已经设置了新的Hortonworks沙箱。我正在尝试使用Java Client API连接Hbase。这是我到目前为止尝试的代码。但没有成功。我没有更改Wortonworks沙箱上的任何配置。我需要在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);
答案 0 :(得分:0)
这也发生在我身上。这是我解决它的方式,更多细节here
我是通过编辑VirtualBox的网络设置来完成的。因此,无需修改Hortonworks沙箱VM中的任何配置文件,例如/etc/hosts
文件或zoo.cfg
文件。
在VirtualBox中,对于Hortonworks Sandbox VM:
如果VM正在运行
转到设置 - >网络,禁用所有当前网络适配器。
创建新的适配器,选择Host-only Adapter
,使用默认设置并应用它。
启动VM,使用root@192.168.56.101将ssh插入其中(192.168.56.101是VM的仅主机适配器的IP。我在启用了两个适配器时找到了它:NAT和仅限主机,ssh进入虚拟机并运行ifconfig
。对于相同版本的虚拟机似乎相同),通过命令行启动hbase。
在计算机的主机中,添加
192.168.56.101 hortonworks.hbase.vm
192.168.56.101 sandbox.hortonworks.com
我使用的Java代码
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");