Get the App
SLTechnology News&Howtos  ›  Servers  › 

What should Eclipse pay attention to when debugging HBase programs

Shulou Source: shulou.com Published: 2022-05-31 21:24:00 09月10日 Update

< cfs.length; i++) { // 表建好后,列簇不能动态增加,而列是可以动态增加的,这是hbase伸缩性的一个体现。 tableDesc.addFamily(new HColumnDescriptor(cfs[i])); } admin.createTable(tableDesc); System.out.println("表创建成功!"); } } // 2、插入数据 public static void writeRow(String tablename, String[] cfs) { try { HTable table = new HTable(conf, tablename); Put put = new Put(Bytes.toBytes("rows1")); for (int j = 0; j < cfs.length; j++) { // 指定列簇// 指定列名// 指定列值 put.add(Bytes.toBytes(cfs[j]), Bytes.toBytes(String.valueOf("列1")), Bytes.toBytes("value_13")); put.add(Bytes.toBytes(cfs[j]), Bytes.toBytes(String.valueOf("lie2")),Bytes.toBytes("value_24")); table.put(put); System.out.println("插入数据成功"); } } catch (IOException e) { e.printStackTrace(); } } // 3、删除一行数据 public static void deleteRow(String tablename, String rowkey) throws IOException { HTable table = new HTable(conf, tablename); List list = new ArrayList(); Delete d1 = new Delete(rowkey.getBytes()); list.add(d1); table.delete(list); System.out.println("删除行成功!"); } // 4、查找一行数据 public static void selectRow(String tablename, String rowKey) throws IOException { HTable table = new HTable(conf, tablename); Get g = new Get(rowKey.getBytes()); Result rs = table.get(g); for (KeyValue kv : rs.raw()) { System.out.print(new String(kv.getRow()) + ">

Thank you for reading! On "Eclipse debugging HBase programs need to pay attention to what" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: Files configuration code projects folders methods programs same content dynamic that is more articles errors appendices good practical obvious successful host Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn Shulou Information Redmi Shulou Tech Info