基本操作: #命名空間級別: #列出所有命名空間 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, ~) #手動分區 #合並分區