hbase shell
list
包含info、data两个列族
create ‘stu’, ‘info’, ‘data’
或者
create ‘student’, {NAME => ‘info’, VERSIONS => ‘3’},{NAME => ‘data’}
row key为rk01,列族info中添加name列标示符,值为zhangsan
put ‘stu’, ‘rk01’, ‘info:name’, ‘zhangsan’
row key为rk01,列族info中添加gender列标示符,值为man
put ‘stu’, ‘rk01’, ‘info:gender’, ‘man’
row key为rk01,列族info中添加age列标示符,值为25
put ‘stu’, ‘rk01’, ‘info:age’, 25
row key为rk01,列族info中添加class列标示符,值为five
put ‘stu’, ‘rk01’, ‘info:class’, ‘five’
row key为rk01,列族data中添加pic列标示符,值为picture
put ‘stu’, ‘rk01’, ‘data:pic’, ‘picture’
获取stu表中row key为rk01的所有信息
get ‘stu’, ‘rk01’
获取stu表中row key为rk01,info列族的所有信息
get ‘stu’, ‘rk01’, ‘info’
获取stu表中row key为rk01,info列族的name、age列标示符的信息
get ‘stu’, ‘rk01’, ‘info:name’, ‘info:age’
获取stu表中row key为rk01,info、data列族的信息
get ‘stu’, ‘rk01’, ‘info’, ‘data’
get ‘stu’, ‘rk01’, {COLUMN => [‘info’, ‘data’]}
get ‘stu’, ‘rk01’, {COLUMN => [‘info:name’, ‘data:pic’]}
获取stu表中row key为rk01,列族为info,版本号最新几个的信息
get ‘stu’, ‘rk01’, {COLUMN => ‘info’, VERSIONS => 2}
get ‘stu’, ‘rk01’, {COLUMN => ‘info:name’, VERSIONS => 5}
get ‘stu’, ‘rk01’, {COLUMN => ‘info:name’, VERSIONS => 5, TIMERANGE => [1538636795600, 1538636989354]}
获取stu表中row key为rk01,cell的值为zhangsan的信息
get ‘stu’, ‘rk01’, {FILTER => “ValueFilter(=, ‘binary:zhangsan’)”}
获取stu表中row key为rk01,列标示符中含有a的信息
get ‘stu’, ‘rk01’, {FILTER => “(QualifierFilter(=,‘substring:a’))”}
put ‘stu’, ‘rk02’, ‘info:name’, ‘lisi’
put ‘stu’, ‘rk02’, ‘info:gender’, ‘woman’
put ‘stu’, ‘rk02’, ‘info:nationality’, ‘中国’
get ‘stu’, ‘rk02’, {FILTER => “ValueFilter(=, ‘binary:中国’)”}
查询stu表中的所有信息
scan ‘stu’
查询stu表中列族为info的信息
scan ‘stu’, {COLUMNS => ‘info’}
scan ‘stu’, {COLUMNS => ‘info’, RAW => true, VERSIONS => 5}
scan ‘stu’, {COLUMNS => ‘info’, RAW => true, VERSIONS => 3}
查询stu表中列族为info和data的信息
scan ‘stu’, {COLUMNS => [‘info’, ‘data’]}
scan ‘stu’, {COLUMNS => [‘info:name’, ‘data:pic’]}
查询stu表中列族为info、列标示符为name的信息
scan ‘stu’, {COLUMNS => ‘info:name’}
查询stu表中列族为info、列标示符为name的信息,并且版本最新的5个
scan ‘stu’, {COLUMNS => ‘info:name’, VERSIONS => 5}
查询stu表中列族为info和data且列标示符中含有a字符的信息
scan ‘stu’, {COLUMNS => [‘info’, ‘data’], FILTER => “(QualifierFilter(=,‘substring:a’))”}
查询stu表中列族为info,rk范围是[rk01, rk03)的数据
scan ‘stu’, {COLUMNS => ‘info’, STARTROW => ‘rk01’, ENDROW => ‘rk03’}
查询stu表中row key以rk字符开头的
scan ‘stu’,{FILTER=>“PrefixFilter(‘rk’)”}
查询stu表中指定范围的数据
scan ‘stu’, {TIMERANGE => [1538637086293,1538638378008]}
删除stu表row key为rk01,列标示符为info:name,timestamp为1538636795600的数据
delete ‘stu’, ‘rk01’, ‘info:name’, 1538636795600
删除stu表row key为rk02,列标示符为info:nationality的数据
delete ‘stu’, ‘rk02’, ‘info:nationality’
清空stu表中的数据
truncate ‘people’
首先停用stu表
disable ‘stu’
添加两个列族f1和f2
alter ‘stu’, NAME => ‘f1’
alter ‘stu’, NAME => ‘f2’
alter ‘stu’, NAME => ‘f1’, METHOD => ‘delete’ 或 alter ‘stu’, ‘delete’ => ‘f1’
添加列族f1同时删除列族f2
alter ‘stu’, {NAME => ‘f1’}, {NAME => ‘f2’, METHOD => ‘delete’}
将stu表的f1列族版本号改为5
alter ‘people’, NAME => ‘info’, VERSIONS => 5
启用表
enable ‘stu’
disable ‘stu’
drop ‘stu’