赞
踩
ntpdate 0.cn.pool.ntp.org 同步服务器时间
1.进入hbase命令行
[root@node1 opt]# hbase shell
命令行写错 , ctrl + back Space 删除
2,创建学生表
hbase(main):004:0> create 'student','info'
3.向student学生表中插入数据
RowKey | timestamp | info | ||
name | sex | age | ||
1001 | Thomas | male | 18 | |
1002 | Janna | female | 20 |
- hbase(main):002:0> put 'student','1001','info:name','Thomas'
- 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','11'
- hbase(main):013:0> put 'student','1002','info:sex','female'
- hbase(main):014:0> put 'student','1002','info:age','10'
4.修改表数据
hbase(main):016:0> put 'student','1002','info:name','janna'
5.查看表数据
hbase(main):017:0> scan 'student'
指定rowkey范围查找
- hbase(main):018:0> scan 'student',{STARTROW =>'1001',STOPROW =>'1001'}
- hbase(main):019:0> scan 'student',{STARTROW =>'1001'}
- #查看指定行数据
- hbase(main):027:0> get 'student','1001'
- #查看指定列簇数据
- hbase(main):027:0> get 'student','1001','info:name'
7.删除表数据
- #删除某rowkey的某一列数据
- hbase(main):028:0> delete 'student','1001','info:isNull'
- #删除某rowkey的全部数据
- hbase(main):028:0> deleteall 'student','1001'
-
- #清空表数据
- hbase(main):005:0> truncate 'student'
- #删除表之前,需要先禁用表
- hbase(main):006:0> disable 'student'
- #查看表是否禁用
- hbase(main):007:0> is_enabled 'student'
- hbase(main):008:0> is_disabled 'student'
- #删除表
- hbase(main):008:0> drop 'student'
8.查看表结构
hbase(main):021:0> desc 'student'
9
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。