How to Insert the Data in HBase Table

  • Sample code Segment

    Configuration config = HBaseConfiguration.create();
    HBaseAdmin h1 = new HBaseAdmin(config);
    HTableDescriptor h2 = new HTableDescriptor("tablename");
    h2.addFamily(new HColumnDescriptor("columnfamily"));
    h1.createTable(h2);
    HTable table=new HTable(config, "tablename");
    Put p=new Put(rowname);
    P.add(columnfamily,columnname,columnvalue);
    table.put(p);

  • Command

    hbase< put 'tablename', 'rowname', 'columnfamily:columnname', 'columnvalue'