0

I am trying to insert the data into hbase. I have mentioned the code below.

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();
}

I am getting the following error

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

From command prompt it is working fine, I am able to create table and add data into it. but when I tried "JPS" ,I got the following output:

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

0 回答 0