如何使用Java客户端API连接到Hortonworks沙箱Hbase [英] How connect to Hortonworks sandbox Hbase using Java Client API
问题描述
我已经安装了新的Hortonworks沙盒。我试图用Java客户端API连接Hbase。这是我迄今试过的代码。但没有成功。我没有更改Wortonworks沙盒上的任何配置。我是否需要在Hbase中做任何配置部分?
配置配置= 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);
这也发生在我身上。以下是我如何解决它,更多细节 here
我通过编辑VirtualBox的网络设置来完成此操作。因此,不需要修改Hortonworks沙盒虚拟机中的任何配置文件,例如 在VirtualBox中,对于Hortonworks Sandbox VM: 停止运行虚拟机 转到设置 - >网络,禁用所有当前网络适配器。 创建一个新的适配器,选择 使用root@192.168.56.101启动虚拟机ssh(192.168.56.101是虚拟机主机专用适配器的IP,当我启用两个适配器时发现它:NAT和host-only,ssh进入虚拟机并运行 在机器的主机中,添加 我使用的Java代码 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 ?
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 In VirtualBox, for the Hortonworks Sandbox VM: Stop the VM if it’s running Go to Settings -> Network, disable all current network adapters. Create a new Adapter, select 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 In the machine’s hosts, add Java Code I use
这篇关于如何使用Java客户端API连接到Hortonworks沙箱Hbase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! / etc / hosts
文件或 zoo.cfg $ c
主机专用适配器
,使用默认设置并应用。
ifconfig
,对于相同版本的虚拟机似乎是相同的),通过命令行启动hbase。
192.168.56.101 hortonworks.hbase.vm
192.168.56.101 sandbox.hortonworks.co m
配置配置= HBaseConfiguration.create();
configuration.set(hbase.zookeeper.property.clientPort,2181);
configuration.set(hbase.zookeeper.quorum,hortonworks.hbase.vm);
configuration.set(zookeeper.znode.parent,/ hbase-unsecure);
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);
/etc/hosts
file or the zoo.cfg
file.
Host-only Adapter
, use the default settings and apply it.ifconfig
. It seems to be the same for the same version of VM), start hbase through command line.
192.168.56.101 hortonworks.hbase.vm
192.168.56.101 sandbox.hortonworks.com
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");