赞
踩
hbase shell
hbase(main):001:0> help
hbase(main):006:0> list
hbase(main):007:0> create 'student', 'base_f1', 'base_f2'
或者
create 'user', {NAME => 'base_f1', VERSIONS => '1'},{NAME => 'base_f2'}
hbase(main):008:0> put 'student', 'rk01', 'base_f1:name', 'zhangsan'
hbase(main):011:0> put 'student', 'rk01', 'base_f2:address', 'beijing'
hbase(main):006:0> get 'student', 'rk01'
hbase(main):007:0> get 'student', 'rk01', 'base_f1'
hbase(main):008:0> get 'student', 'rk01', 'base_f1:name', 'base_f2:address'
hbase(main):010:0> get 'student', 'rk01', 'base_f1', 'base_f2'
或者
hbase(main):011:0> get 'student', 'rk01', {COLUMN => ['base_f1', 'base_f1']}
或者
hbase(main):012:0> get 'student', 'rk01', {COLUMN => ['base_f1:name', 'base_f2:address']}
hbase(main):013:0> get 'student', 'rk01', {FILTER => "ValueFilter(=, 'name:zhangsan')"}
hbase(main):015:0> get 'student', 'rk01', {FILTER => (QualifierFilter(=,'substring:a'))"}
hbase(main):016:0> put 'student', 'rk02', 'base_f1:name', '李四'
hbase(main):019:0> put 'student', 'rk02', 'base_f2:address', 'shanghai'
hbase(main):020:0> scan 'student'
hbase(main):021:0> scan 'student', {COLUMNS => 'base_f1'}
hbase(main):022:0> scan 'student', {COLUMNS => 'base_f1', RAW => true, VERSIONS => 5}
## Scan时可以设置是否开启Raw模式,开启Raw模式会返回包括已添加删除标记但是未实际删除的数据
## VERSIONS指定查询的最大版本数
hbase(main):023:0> scan 'student', {COLUMNS => ['base_f1', 'base_f2']}
hbase(main):024:0> scan 'student', {COLUMNS => ['base_f1:name', 'base_f2:address']}
hbase(main):025:0> scan 'student', {COLUMNS => 'base_f1:name'}
hbase(main):026:0> scan 'student', {COLUMNS => 'base_f1:name', VERSIONS => 3}
hbase(main):027:0> scan 'student', {COLUMNS => ['base_f1 ', 'base_f2'], FILTER => "(QualifierFilter(=,'substring:aa'))"}
hbase(main):028:0> scan 'student', {COLUMNS => 'base_f1', STARTROW => 'rk01', ENDROW => 'rk03'}
hbase(main):029:0> scan 'student',{FILTER=>"PrefixFilter('rk')"}
hbase(main):030:0> put 'student', 'rk01', 'base_f1:name', 'zhangsansan'
hbase(main):031:0> alter 'student', NAME => 'base_f1', VERSIONS => 5
hbase(main):032:0> delete 'student', 'rk01', 'base_f1:name'
hbase(main):033:0> delete 'student', 'rk01', 'base_f1:name', 1392383705316
hbase(main):034:0> alter 'student', NAME => 'base_f1', METHOD => 'delete'
或者
hbase(main):035:0> alter 'student', 'delete' => 'base_f1'
hbase(main):036:0> truncate 'student'
#先disable 再drop
hbase(main):036:0> disable 'student'
hbase(main):037:0> drop 'student'
#如果不进行disable,直接drop会报错
ERROR: Table student is enabled. Disable it first.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。