基本操作
1. 进入 HBase 客户端命令行
bin/hbase shell
2. 查看帮助命令
help
3.查看当前数据库中有哪些表
list
基本操作
1.创建表
create 'student','info'
2.插入数据到表
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'
3.扫描查看表数据
scan 'student'
scan 'student',{STARTROW => '1001', STOPROW =>
'1001'}
scan 'student',{STARTROW => '1001'}
4.查看表结构
describe 'student'
5.更新指定字段的数据
put 'student','1001','info:name','Nick'
put 'student','1001','info:age','100'
6.查看“指定行”或“指定列族:列”的数据
get 'student','1001'
get 'student','1001','info:name'
7.统计表数据行数
count 'student'
8.删除数据
删除某 rowkey 的全部数据:
删除某 rowkey 的某一列数据:
delete 'student','1002','info:sex'
9.清空表数据
truncate 'student'
提示:清空表的操作顺序为先 disable,然后再 truncate。
10.删除表
首先需要先让该表为 disable 状态:
disable 'student'
drop 'student'
11.变更表信息
alter 'student',{NAME=>'info',VERSIONS=>3}
get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}