HBase笔记
启动
启动HBase
start-hbase.sh
关闭HBase
stop-hbase.sh
进入shell
hbase shell
帮助
help
help 'namespace' # 具体命令的详细帮助
命名空间
增
create_namespace 'ns'
删
drop_namespace 'ns' # 必须为空
查
list_namespace # 所有命名空间
describe_namespace 'ns' # 详细信息
表结构操作
增
create 'ns:t1', 'id'
create '命名空间:表名', '列族'
删
disable 'ns:t1'
drop 'ns1:t1'
查
list # 所有表
list_namespace_tables 'ns' # 指定命名空间下的所有表
列族
增
alter 'ns:t1', NAME => 'info', VERSIONS => 5 # 不存在info
删
alter 'ns:t1', NAME => 'info', METHOD => 'delete' # 方式一
alter 'ns:t1', 'delete' => 'info' # 方式二
改
alter 'ns:t1', NAME => 'info', VERSIONS => 5 # 已存在info,则改VERSIONS
查
describe 'ns:t1'
表数据操作
增
put 'ns:t1','1','id:name','zhangsan'
put 'ns:t1','行号','列族:列名','数据'
删
delete 'ns:t1','1','id:name' # 删除最新一个版本
deleteall 'ns:t1','1','id:name' # 删除所有版本
改
put 'ns:t1','1','id:name','zhangsan' # put相同行号,相同列名则覆盖数据
查
get 'ns:t1', '1' # 查单行
get 'ns:t1','1', {COLUMN =>['id:name', 'id:age']} # 查单行,过滤列
get 'ns:t1','1', {COLUMN => 'id:name'} # 查单个值,所有版本
scan 'ns:t1' # 查所有
scan 'ns:t1', {STARTROW => '1', STOPROW => '3'} # 查多行,左闭右开
License:
CC BY 4.0