Hadoop和hbase java客户端问题

时间:2013-01-11 10:51:01

标签: java hadoop hbase

我正在尝试将数据插入hbase。我已经提到了下面的代码。

try {
    Configuration conf = HBaseConfiguration.create();
    conf.clear();
    conf.set("hbase.zookeeper.quorum", "<HOST_IP>:2181");
    conf.set("hbase.zookeeper.property.clientPort", "2181");
    conf.set("hbase.zookeeper.dns.nameserver", "<HOST_IP>");
    conf.set("hbase.regionserver.port","60020");
    conf.set("hbase.master", "<HOST_IP>:9000");
    HTable table = new HTable(conf, "test");
    Put put = new Put(Bytes.toBytes("row5"));
    put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
    Bytes.toBytes("val1"));
    put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"),
    Bytes.toBytes("val2"));
    table.put(put);
} catch (MasterNotRunningException e) { 
    e.printStackTrace(); 
} catch (ZooKeeperConnectionException e) { 
    e.printStackTrace(); 
} catch (TableNotFoundException e) { 
    e.printStackTrace(); 
} catch (IOException e) { 
    e.printStackTrace();
}

我收到以下错误

zookeeper.ClientCnxnSocket: Connected to an old server; r-o mode will be unavailable.

从命令提示符它工作正常,我能够创建表并向其中添加数据。但是当我尝试“JPS”时,我得到了以下输出:

15898 HRegionServer
15359 HMaster
14810 SecondaryNameNode
14616 DataNode
14909 JobTracker
15056 TaskTracker
15988 Jps
14487 NameNode
15302 HQuorumPeer

0 个答案:

没有答案