gpt4 book ai didi

java - 从Windows Java应用程序访问Virtual Box HBase

转载 作者:行者123 更新时间:2023-12-02 22:05:07 25 4
gpt4 key购买 nike

嗨,我是hbase的新手,正在尝试练习它。首先,我想描述一下系统配置。
背景:

我正在使用Windows 7并安装了Oracle Virtual Box。然后,我在Virtual Box上安装了ubuntu服务器,然后在ubuntu上安装了hbase0.98-hadoop2-bin.tar.gz。我已经在独立模式下配置了hbase。我的hbase-site.xml文件是这样的:

<Configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///home/abc/hbase</value>
</property>

<property>
<name>hbase.zookeeper.property.rootDir</name>
<value>/home/abc/zookeeper</value>
</property>
</configuration>

现在我的hbase shell可以正常工作了,它可以创建表。我可以放下值(value)并得到它们。

主要问题:

如前所述,我使用Windows,因此我在eclipse上用Java编写了一个简单的程序来命中hbase(基本上在虚拟框中)。但是我得到以下异常:
Exception in thread "main" org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See HTable's javadoc for more information.
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:155)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.java:990)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.java:303)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:294)
at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:156)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:168)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:146)
at HBaseConnector.main(HBaseConnector.java:151)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
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:1021)
at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1049)
at org.apache.hadoop.hbase.zookeeper.ZKUtil.createAndFailSilent(ZKUtil.java:903)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:133)

我的代码:
主要功能中的代码如下:
Configuration config = HBaseConfiguration.create();
HTable table = new HTable(config, "myLittleHBaseTable");
Put p = new Put(Bytes.toBytes("myLittleRow"));

我想要什么?

我究竟做错了什么?
我有什么办法可以从Windows Java程序访问hbase(位于虚拟框上)?

PLUS:

我研究了以前提出的问题,但没有一个对我有用。

任何帮助将是非常感谢。

最佳答案

您是否尝试将“虚拟”框的“网络”设置设置为“桥接适配器”而不是“NAT”,
然后在您的主机系统上,尝试打开浏览器并键入“guestIP:Hbase_Master_Port”(例如192.168.1.100:60010),它将打开主管理页面。

关于java - 从Windows Java应用程序访问Virtual Box HBase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26002871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com