Pages

Sunday, 22 December 2013

Adding/Delete Column Family (HBase)

Adding/Delete a Column Family (HBase)

private static Configuration conf;
//Choose conf settings

HBaseAdmin hAdmin = new HBaseAdmin(conf);
hAdmin.disableTable("[TABLE]"); //MUST DISABLE FIRST

//Delete column family
hAdmin.deleteColumn("[TABLE]", "[COLUMN FAMILY]");

//Add it back
HColumnDescriptor cfA = new HColumnDescriptor(Bytes.toBytes("iq4"));
hAdmin.addColumn("[COLUMN FAMILY]", cfA);
hAdmin.enableTable("1005063l");  //ALWAYS RE-ENABLE
hAdmin.close();  

No comments:

Post a Comment