文章目录
配置hbase
1、创建表
hbase(main):001:0> create ‘student’,‘info’
0 row(s) in 1.7390 seconds=> Hbase::Table - student
2、插入操作
hbase(main):003:0> put ‘student’,‘1001’,‘info:sex’,‘male’
0 row(s) in 0.1900 secondshbase(main):004:0> put ‘student’,‘1001’,‘info:age’,‘18’ 0 row(s) in
0.0120 secondshbase(main):005:0> put ‘student’,‘1002’,‘info:name’,‘Janna’ 0 row(s)
in 0.0110 secondshbase(main):006:0> put ‘student’,‘1002’,‘info:sex’,‘female’ 0 row(s)
in 0.0150 secondshbase(main):007:0> put ‘student’,‘1002’,‘info:age’,‘20’ 0 row(s) in
0.0090 seconds
3、扫描操作
hbase(main):008:0> scan ‘student’
ROW COLUMN+CELL
1001 column=info:age, timestamp=1646721702293, value=18
1001 column=info:sex, timestamp=1646721628821, value=male
1002 column=info:age, timestamp=1646721777038, value=20
1002 column=info:name, timestamp=1646721731729, value=Janna
1002 column=info:sex, timestamp=1646721755938, value=female
2 row(s) in 0.0640 seconds
4、查看操作
hbase(main):009:0> describe ‘student’
Table student is ENABLED
student
COLUMN FAMILIES DESCRIPTION
{NAME => ‘info’, BLOOMFILTER => ‘ROW’, VERSIONS => ‘1’, IN_MEMORY => ‘false’, KEEP_DELETED_CELLS => ‘FALSE’, DATA_BLOCK_ENCODING => 'NON
CHE => ‘true’, BLOCKSIZE => ‘65536’, REPLICATION_SCOPE => ‘0’}
1 row(s) in 0.0590 seconds
5、更新操作
hbase(main):010:0> put ‘student’,‘1001’,‘info:age’,‘100’
0 row(s) in 0.0150 seconds
6、获取指定字段
hbase(main):011:0> get ‘student’,‘1001’
COLUMN CELL
info:age timestamp=1646721919836, value=100
info:sex timestamp=1646721628821, value=male
1 row(s) in 0.0450 seconds
7、统计操作
hbase(main):012:0> count ‘student’
2 row(s) in 0.0230 seconds=> 2
8、删除操作
delete ’student’,‘1002’,‘info:sex’
删除全部
deleteall ‘student’,‘1001’
清空表
truncate ‘student’