七、HBASE-03
HBase Shell操作
1、基本操作
[lyinl@hadoop102 hbase]$ bin/hbase shell
hbase(main):001:0> help
hbase(main):002:0> list
2、表的操作
hbase(main):002:0> create 'student','info'
hbase(main):003:0> put 'student','1001','info:sex','male'
hbase(main):004:0> put 'student','1001','info:age','18'
hbase(main):005:0> put 'student','1002','info:name','Janna'
hbase(main):006:0> put 'student','1002','info:sex','female'
hbase(main):007:0> put 'student','1002','info:age','20'
hbase(main):008:0> scan 'student'
hbase(main):009:0> scan 'student',{STARTROW => '1001', STOPROW =>
'1001'}
hbase(main):010:0> scan 'student',{STARTROW => '1001'}
hbase(main):011:0> describe ‘student’
hbase(main):012:0> put 'student','1001','info:name','Nick'
hbase(main):013:0> put 'student','1001','info:age','100'
hbase(main):014:0> get 'student','1001'
hbase(main):015:0> get 'student','1001','info:name'
hbase(main):021:0> count 'student'
hbase(main):016:0> deleteall 'student','1001'
hbase(main):017:0> delete 'student','1002','info:sex'
hbase(main):018:0> truncate 'student'
注意:清空表的操作顺序为先 disable,然后再 truncate。
hbase(main):019:0> disable 'student'
注意:如果直接 drop 表,会报错:ERROR: Table student is enabled. Disable it first
hbase(main):022:0> alter 'student',{NAME=>'info',VERSIONS=>3}
hbase(main):022:0> get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}
|