进入HBase客户端命令操作界面 bin/hbase shell

查看帮助命令 help

查看当前数据库中有哪些表 list

创建一张表 create 'student','info' student表名 info列族名

向表中存储一些数据 put 'student','1001','info:name','Thomas'
put '表名','rowkey','列族名:列名','值'
修改和添加操作一样,直接就覆盖了
扫描查看存储的数据 scan 'student' scan '表名'
时间戳自动加进去的.
想要在这个客户端删除的话,按住ctrl+删除键

查看某个rowkey范围内的数据
scan 'student',{STARTROW => '1001',STOPROW => '1003'}

查看表结构 describe 'student'

查看指定行的数据 get 'student','1001'

查看指定行指定列或列族的数据 get 'student','1001','info:name'

统计一张表有多少行数据 count 'student' 查的是有多少个rowkey

删除数据
删除某一个rowKey全部的数据 deleteall 'student','1001'
删除掉某个rowKey中某一列的数据 delete 'student','1001','info:sex'
清空表数据 truncate 'student'
清空表数据它其实执行了三步,先把表变为不可用,然后删除它,然后又创建它.

删除表
首先需要先让该表为disable状态,使用命令:
hbase(main):018:0> disable 'student'
然后才能drop这个表,使用命令:
hbase(main):019:0> drop 'student'
(尖叫提示:如果直接drop表,会报错:Drop the named table. Table must first be disabled)
相关文章: