Hbase 删除列族

删除列族

使用alter,也可以删除列族。下面给出的是使用alter删除列族的语法。

hbase> alter ‘ table name ’, ‘delete’ => ‘ column family ’

下面给出的是一个例子,从“emp”表中删除列族。

假设在HBase中有一个employee表。它包含以下数据:

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

现在使用alter命令删除指定的 professional 列族。

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

现在验证该表中变更后的数据。观察列族“professional”也没有了,因为前面已经被删除了。

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

参考
http://www.yiibai.com/hbase/hbase_describe_and_alter.html

猜你喜欢

转载自wangqiaowqo.iteye.com/blog/2335101