1 delete 删除表的某一列值
hbase(main):003:0> scan 'test10'
ROW COLUMN+CELL
myrow-1 column=colfam1:q1, timestamp=1574693256009, value=value-1
myrow-2 column=colfam1:q1, timestamp=1574693267180, value=value-3
myrow-3 column=colfam1:name, timestamp=1574693404696, value=fandong
myrow-4 column=colfam1:name, timestamp=1574694474272, value=fandong
myrow-4 column=colfam1:q1, timestamp=1574694503077, value=value-4
4 row(s) in 0.2180 seconds
hbase(main):004:0> delete 'test10','myrow-4','colfam1:name'
0 row(s) in 0.0950 seconds
hbase(main):005:0> scan 'test10'
ROW COLUMN+CELL
myrow-1 column=colfam1:q1, timestamp=1574693256009, value=value-1
myrow-2 column=colfam1:q1, timestamp=1574693267180, value=value-3
myrow-3 column=colfam1:name, timestamp=1574693404696, value=fandong
myrow-4 column=colfam1:q1, timestamp=1574694503077, value=value-4
4 row(s) in 0.0170 seconds
2、 disable 禁用表
drop 表前一定要先禁用,否则无法删除表。
hbase(main):006:0> disable 'test11'
0 row(s) in 1.5660 seconds
hbase(main):007:0> describe 'test11'
Table test11 is DISABLED
test11
COLUMN FAMILIES DESCRIPTION
{NAME => 'colfam1', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0',
BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
1 row(s) in 0.0450 seconds
hbase(main):008:0> drop 'test11'
0 row(s) in 0.6680 seconds
hbase(main):009:0> list
TABLE
test10
1 row(s) in 0.0080 seconds
=> ["test10"]
hbase(main):010:0>
命名空间 namespace ,方便管理表,类似数据的databases。
hbase(main):001:0> create_namespace 'weibo'
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hBase/pseduo_hbase-0.98.17-hadoop2/hbase-0.98.17-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data/bigData/hadoop-2.9.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
0 row(s) in 2.7210 seconds
hbase(main):002:0> create 'weibo:content','info'
0 row(s) in 0.9640 seconds
=> Hbase::Table - weibo:content
hbase(main):003:0> list
TABLE
test10
weibo:content
2 row(s) in 0.0140 seconds
=> ["test10", "weibo:content"]
hbase(main):004:0> scan 'weibo:content'
ROW COLUMN+CELL
0 row(s) in 0.0600 seconds
--删除命名空间
tips: 命名空间删除,只能是namespace 下没有表的时候,才可以操作删除。
hbase(main):003:0> create_namespace 'namespace1'
0 row(s) in 0.0830 seconds
hbase(main):004:0> drop_namespace 'namespace1'
0 row(s) in 0.0590 seconds
--修改命名空间
hbase(main):006:0> alter_namespace 'weibo',{METHOD => 'set', 'creater' => 'liushui'}
0 row(s) in 0.0540 seconds
hbase(main):007:0> describe_namespace 'weibo'
DESCRIPTION
{NAME => 'weibo', creater => 'liushui'}
1 row(s) in 0.0080 seconds
hbase(main):008:0>