基本操作:
#命名空间级别:
#列出所有命名空间
hbase> list_namespace
#新建命名空间
hbase> create_namespace 'ns1'
#删除命名空间
hbase> drop_namespace 'ns1'
#修改命名空间
#表级别:
#列出所有表
hbase> list
#列出指定命名空间下的所有表
hbase> list_namespace_tables 'ns1'
#新建一个以命名空间ns1的表t1,列族为cf1。
hbase> create 'ns1:t1', 'cf1'
#删除表
hbase> disable 'ns1:t1'
hbase> drop 'ns1:t1'
#修改表名
HBase没有rename命令,可以通过快照功能修改表名,详见下述。
#查看表内容
hbase> scan 'ns1:t1', {LIMIT=>5} # 查看前5行数据
#插入
hbase> put 'ns1:t1', 'r1', 'cf1:c1', 'value'
#查看
hbase> get 'ns1:t1', 'r1'
#表分区(region分裂多个region以及region合并)
#建表预分区
create 'gld:student', 'cf1', {SPLITS => ['1', '2', '3', '4', '5', '6', '7', '8', '9']}
每个分区的Start Key和End Key分别为:(~, 1),[1, 2),[2, 3),[3, 4),[4, 5),[5, 6),[6, 7),[7, 8),[8, 9),[9, ~)
#手动分区
#合并分区