hbase各种例子新增修改删除批量导入

时间:2017-08-24 07:25:14
【文件属性】:
文件名称:hbase各种例子新增修改删除批量导入
文件大小:132KB
文件格式:RAR
更新时间:2017-08-24 07:25:14
hbase 新增 修改 删除 批量导入 hbase各种例子新增修改删除批量导入: public static void main(String[] args) throws IOException { Configuration conf = HBaseConfiguration.create(); HBaseHelper helper = HBaseHelper.getHelper(conf); helper.dropTable("testtable"); helper.createTable("testtable", "colfam1"); HTable table = new HTable(conf, "testtable"); // vv PutListExample List puts = new ArrayList(); // co PutListExample-1-CreateList Create a list that holds the Put instances. Put put1 = new Put(Bytes.toBytes("row1")); put1.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), Bytes.toBytes("val1")); puts.add(put1); // co PutListExample-2-AddPut1 Add put to list. Put put2 = new Put(Bytes.toBytes("row2")); put2.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), Bytes.toBytes("val2")); puts.add(put2); // co PutListExample-3-AddPut2 Add another put to list. Put put3 = new Put(Bytes.toBytes("row2")); put3.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"), Bytes.toBytes("val3")); puts.add(put3); // co PutListExample-4-AddPut3 Add third put to list. table.put(puts); // co PutListExample-5-DoPut Store multiple rows with columns into HBase. // ^^ PutListExample }

网友评论

  • 不错的资源,谢谢分享
  • 对初学者有一定的帮助