kalor

导航

 

修改HBase表结构之前首先需要disable表,然后进行更改相关表结构信息,最后enable表,如下

1. 动态添加一个或多个列簇

hbase(main):034:0> describe 'HiddenIPInfo'
DESCRIPTION                                                                   ENABLED                                   
 'HiddenIPInfo', {NAME => 'IPAddress', DATA_BLOCK_ENCODING => 'NONE', BLOOMFI true                                      
 LTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'N                                           
 ONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false                                           
 ', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLO                                           
 CKCACHE => 'true'}      

hbase(main):024:0> disable 'HiddenIPInfo'
0 row(s) in 4.9910 seconds

hbase(main):025:0> alter 'HiddenIPInfo','Address','family1','family2'......(添加一个or多个列簇
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 2.5730 seconds

hbase(main):026:0> enable 'HiddenIPInfo'
0 row(s) in 3.0570 seconds

hbase(main):027:0> describe 'HiddenIPInfo'
DESCRIPTION                                                                   ENABLED                                   
 'HiddenIPInfo', {NAME => 'Address', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILT true                                      
 ER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '                                           
 3', TTL => '2147483647', MIN_VERSIONS => '0', KEEP_DELETED_CELLS => 'false',                                           
  BLOCKSIZE => '65536', ENCODE_ON_DISK => 'true', IN_MEMORY => 'false', BLOCK                                           
 CACHE => 'true'}, {NAME => 'IPAddress', DATA_BLOCK_ENCODING => 'NONE', BLOOM                                           
 FILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION =>                                            
 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'fal                                           
 se', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', B                                           
 LOCKCACHE => 'true'}      

1. 动态删除一个(only 1)列簇(若删除多个列簇,需逐个删除)

hbase(main):031:0> disable 'HiddenIPInfo'
0 row(s) in 1.6290 seconds

hbase(main):032:0> alter 'HiddenIPInfo','delete' => 'Address'
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 1.8950 seconds

hbase(main):033:0> enable 'HiddenIPInfo'
0 row(s) in 1.5700 seconds

hbase(main):034:0> describe 'HiddenIPInfo'
DESCRIPTION                                                                   ENABLED                                   
 'HiddenIPInfo', {NAME => 'IPAddress', DATA_BLOCK_ENCODING => 'NONE', BLOOMFI true                                      
 LTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'N                                           
 ONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false                                           
 ', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLO                                           
 CKCACHE => 'true'}                                                                                                     
1 row(s) in 0.1390 seconds

 

posted on 2013-12-09 20:09  kalor  阅读(854)  评论(0编辑  收藏  举报