标签:实现 总结 iba esc ble color style sim delete
1、查看读取器状态
status
2、查看hbase版本
version
3、创建一个表:格式: create 表名,列簇1,列簇2...列簇N
create ‘member’,‘member_id‘,‘address‘,‘info‘
4、查看表描述
describe ‘member‘
5、删除一个列簇:先关闭,再更新,再打开
disable ‘member‘
alter‘member‘,NAME=>‘member_id‘,METHOD=>‘delete‘
enable ‘member‘
6、列出所有表
list
7、删除一个表:先关闭,再删除
disable ‘member‘
drop ‘member‘
8、查询表是否存在
exists ‘member‘
9、判断表是否enable
is_enabled ‘member‘
10、判断表是否disable
is_disabled ‘member‘
11、插入数据:在列簇中插入数据:格式:put 表名,行键id,列簇名:列名,值
put ‘member‘,‘xiaoming‘,‘address:contry‘,‘china‘
put ‘member‘,‘xiaoming‘,‘address:province‘,‘sc‘
put ‘member‘,‘xiaoming‘,‘address:city‘,‘cd‘
put ‘member‘,‘xiaoming‘,‘info:age‘,‘25‘
put ‘member‘,‘xiaoming‘,‘info:birthday‘,‘1992-10-21‘
put ‘member‘,‘xiaoming‘,‘info:company‘,‘alibaba‘
12、获取一个id的所有数据
get ‘member‘,‘xiaoming‘
13、获取一个id,一个列族的所有数据
get ‘member‘,‘xubiao‘,‘info‘
14、获取一个id,一个列族中一个列的所有数据
get ‘member‘,‘xiaoming,‘info:age‘
15、更新一条记录:给rowId重新put即可,
put ‘member‘,‘xiaoming‘,‘info:age‘,‘26‘ // 把xiaoming的age改为26
16、通过timestamp来获取两个版本的数据
get ‘member‘,‘xiaoming‘,{COLUMN=>‘info:age‘,TIMESTAMP=>1510840447626}
17、全表扫描
scan ‘member‘
18、删除id为xiaomiing的值的‘info:age‘字段
delete ‘member‘,‘xiaoming‘,‘info:age‘
19、删除整行
deteleall ‘member‘,‘xiaoming‘
20、查询表中有多少行
count ‘member‘
21、将整张表清空:实际执行过程:hbase是先将表disable,然后drop,后重建表,来实现truncate的功能的
truncate ‘member‘
总结可以加深印象,同时还能为大家提供方便。
标签:实现 总结 iba esc ble color style sim delete
原文地址:http://www.cnblogs.com/xubiao/p/7845442.html