$ bin/hbase shell
hbase(main)> help
hbase(main)> list
注意:在hbase shell中退格需要用ctrl+退格键
-- create '表名,'列族(colum-family)'
ex: hbase> create 'student','info'
hbase> put '表名','rowkey','列族名:列名1','值'
ex: hbase> put 'student','1001','info:name','daxiong'
hbase(main) > put 'student','1001','info:name','Thomas'
hbase(main) > put 'student','1001','info:sex','male'
hbase(main) > put 'student','1001','info:age','18'
hbase(main) > put 'student','1002','info:name','Janna'
hbase(main) > put 'student','1002','info:sex','female'
hbase(main) > put 'student','1002','info:age','20'
--查看全表
hbase > scan 'student'
-- 查看指定范围
hbase > scan 'student',{STARTROW => '1001',STOPROW => '1002'}
-- 查看指定行
hbase > get 'student','1001'
hbase > get 'student','1001','info'
hbase > get 'student','1001','info:name'
上述操作的区间:前闭后开
hbase(main): describe 'student'
--删除某rowkey的全部数据
hbase(main) > deleteall 'student','1001'
--删除某rowkey的全部数据
hbase(main) > deleteall 'student','1001','info:sex'
hbase(main) > truncate 'student'
清空表的操作顺序为先disable,然后再truncating
--首先需要先让该表为disable状态
hbase(main) > disable 'student'
--然后才能drop这个表
hbase(main) > drop 'student'
如果直接drop表,会报错:Drop the named table. Tablemust first be disabled
ERROR: Table student is enabled. Disable itfirst.
hbase(main) > count 'student'