当前位置 博文首页 > 后端码匠:HBase Shell 基本操作
bin/hbase shell
help
list
create 'student','info'
put 'student','1001','info:sex','male'
put 'student','1001','info:age','18'
put 'student','1002','info:name','Janna'
put 'student','1002','info:sex','female'
put 'student','1002','info:age','20'
scan 'student'
scan 'student',{STARTROW => '1001', STOPROW => '1001'}
scan 'student',{STARTROW => '1001'}
describe 'student'
put 'student','1001','info:name','Nick'
put 'student','1001','info:age','100'
get 'student','1001'
get 'student','1001','info:name'
count 'student'
删除某 rowkey 的全部数据
deleteall 'student','1001'
删除某 rowkey 的某一列数据
delete 'student','1002','info:sex'
truncate 'student'
提示:清空表的操作顺序为先 disable,然后再 truncate。
首先需要先让该表为 disable 状态
disable 'student'
然后才能 drop 这个表
drop 'student'
提示:如果直接 drop 表,会报错:ERROR: Table student is enabled. Disable it first.
将 info 列族中的数据存放 3 个版本:
alter 'student',{NAME=>'info',VERSIONS=>3}
get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}
cs