Hbase delete column family

Deleting a Column Family

Using alter, you can also delete a column family. Given below is the syntax to drop a column family using alter.

hbase> alter ' table name ', 'delete' => ' column family '

Given below is an example to delete a column family from 'emp' table.

Suppose there is an employee table in HBase. It contains the following data:

hbase(main):006:0> scan 'employee'

         ROW COLUMN+CELL

row1 column=personal:city, timestamp=1418193767, value=hyderabad

row1 column=personal:name, timestamp=1418193806767, value=raju

row1 column=professional:designation, timestamp=1418193767, value=manager

row1 column=professional:salary, timestamp=1418193806767, value=50000

1 row(s) in 0.0160 seconds

Now use the alter command to drop the specified professional column family.

hbase(main):007:0> alter 'employee','delete'=>'professional'
Updating all regions with the new schema...
0/1 regions updated.
1/1 regions updated.
Done.
0 row(s) in 2.2380 seconds

Now validates the changed data in this table. Observe that the column family "professional" is also gone, since the previous has been removed.

hbase(main):003:0> scan 'employee'
ROW COLUMN+CELL
row1 column=personal:city, timestamp=14181936767, value=hyderabad

row1 column=personal:name, timestamp=1418193806767, value=raju

1 row(s) in 0.0830 seconds

refer to
http://www.yiibai.com/hbase/hbase_describe_and_alter.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326446329&siteId=291194637
Recommended