您好我是hbase的新手,并尝试练习它。首先,我想描述系统配置。 的背景
我正在使用Windows 7并安装了Oracle Virtual Box。然后在ubuntu上安装了hbase0.98-hadoop2-bin.tar.gz后,在Virtual Box上安装了ubuntu服务器。我在独立模式下配置了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工作正常,它创建了表。我可以把价值观拿到来。
主要问题:
如上所述,我正在使用Windows,因此我在java中使用eclipse编写了一个简单的程序来命中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:
我研究过之前提出的问题,但没有一个能为我工作。
任何帮助都会非常感激。
答案 0 :(得分:0)
您是否尝试将虚拟框的网络设置设置为&#34;桥接适配器&#34;而不是&#34; NAT&#34; , 然后从您的主机系统,尝试打开浏览器并键入&#34; guestIP:Hbase_Master_Port&#34;(例如192.168.1.100:60010)它应该打开主管理页面。