Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hadoop 在ubuntu上的eclipse中运行Hbase示例_Hadoop_Hbase - Fatal编程技术网

Hadoop 在ubuntu上的eclipse中运行Hbase示例

Hadoop 在ubuntu上的eclipse中运行Hbase示例,hadoop,hbase,Hadoop,Hbase,我是Hbase和Hadoop的新手 我正在Ubuntu中以伪模式设置Hadoop(1.2.1)和hbase(0.94.27) 我还使用habse shell成功地创建数据或将数据插入hbase表 但当我试图编写一个简单的程序,在Eclipse中使用JavaAPI向表中插入数据时 public class HbaseTest { public static void main(String[] args) throws Exception { Configuration

我是Hbase和Hadoop的新手

我正在Ubuntu中以伪模式设置Hadoop(1.2.1)和hbase(0.94.27)

我还使用habse shell成功地创建数据或将数据插入hbase表

但当我试图编写一个简单的程序,在Eclipse中使用JavaAPI向表中插入数据时

public class HbaseTest {
     public static void main(String[] args) throws Exception {
         Configuration conf = HBaseConfiguration.create();
         HBaseAdmin admin = new HBaseAdmin(conf);
         try {
             HTable table = new HTable(conf, "test-table");
             Put put = new Put(Bytes.toBytes("test-key"));
             put.add(Bytes.toBytes("cf"), Bytes.toBytes("q"), Bytes.toBytes("value"));
             table.put(put);
         } finally {
             admin.close();
         }
     }
}
,我得到以下错误:

15/05/30 01:24:20 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection0x0
15/05/30 01:24:20 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
15/05/30 01:24:20 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
15/05/30 01:24:21 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
15/05/30 01:24:21 INFO util.RetryCounter: Sleeping 2000ms before retry #1...
15/05/30 01:24:22 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
15/05/30 01:24:22 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
我试图搜索类似的错误,但到目前为止还没有找到解决方案

有人有处理这个问题的经验吗?请帮帮我

此外,我的hbase-site.xml如下所示

>   <configuration> <property>
>         <name>hbase.rootdir</name>
>             <value>hdfs://localhost:54310/hbase</value>
>     </property>
>     <property>
>       <name>hbase.zookeeper.property.dataDir</name>
>       <value>/home/hduser/zookeeper</value>
>       <description>Property from ZooKeeper's config zoo.cfg.
>       The directory where the snapshot is stored.
>       </description>
>     </property> </configuration>

谢谢

请查找更多关于您错误的参考资料,以防您遗漏。快乐编码:)

谢谢您的帮助。我已经看过你的链接,但还没有找到解决我的问题的办法。我可以在Hbase外壳中运行良好,但不能在Eclipse的Java中运行程序,它总是显示该异常
> 127.0.0.1 localhost
> 127.0.0.1 testuser-VirtualBox