HBase刪除列族報錯的解決方法

chenfeng發表於2017-03-01
今天做實驗,刪除member表某一列的時候,報錯
hbase(main):003:0> alter 'member','delete'=>'info'

ERROR: org.apache.hadoop.hbase.TableNotDisabledException: org.apache.hadoop.hbase.TableNotDisabledException: member
        at org.apache.hadoop.hbase.master.HMaster.checkTableModifiable(HMaster.java:1217)
        at org.apache.hadoop.hbase.master.handler.TableEventHandler.<init>(TableEventHandler.java:70)
        at org.apache.hadoop.hbase.master.handler.TableDeleteFamilyHandler.<init>(TableDeleteFamilyHandler.java:40)
        at org.apache.hadoop.hbase.master.HMaster.deleteColumn(HMaster.java:1125)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:364)
        at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1326)


解決方案:先disable這張表:
hbase(main):005:0> disable 'member'
0 row(s) in 2.1560 seconds


然後再刪除:
hbase(main):006:0> alter 'member', 'delete' => 'info'
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 1.3370 seconds


檢視錶情況:

hbase(main):011:0> describe 'member'
DESCRIPTION                                                                                 ENABLED
 {NAME => 'member', FAMILIES => [{NAME => 'address', BLOOMFILTER => 'NONE', REPLICATION_SCO true
 PE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647
 ', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'member_id'
 , BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE',
  MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLO
 CKCACHE => 'true'}]}
1 row(s) in 0.0140 seconds

我們可以發現member表的info欄位已經被刪除了。

最後記得要啟用表:

hbase(main):009:0> enable 'member'
0 row(s) in 2.2330 seconds

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2134473/,如需轉載,請註明出處,否則將追究法律責任。

相關文章