Hbase常用操作手法

1、建立表tablea, 并使得tablea有一个columnfamily——cf1

create 'tablea', 'cf1'

2、在tablea表中插入rowkey1,cf1,key1=value1的信息
put 'tablea', 'rowkey1', 'cf1:key1', 'value1'

3、查询tablea
scan 'tablea'

4、插入多条数据
put 'tablea', 'rowkey2', 'cf1:key2', 'value2'
put 'tablea', 'rowkey3', 'cf1:key3', 'value3'
scan 'tablea'

5、搜索单条数据
get 'tablea','rowkey1'
get 'tablea','rowkey2'

get 'tablea','rowkey'

6、建立一个表tableb, 拥有cf1, cf2两个columnfamily
create 'tableb','cf1','cf2'

7、搜索value=?
put 'tableb','rowkey1','cf1:key1','value1'
put 'tableb','rowkey2','cf1:key1','value1'
put 'tableb','rowkey3','cf1:key1','value1'
put 'tableb','rowkey3','cf1:key1','value1'
put 'tableb','rowkey3','cf2:key1','value1'

scan 'tableb', FILTER=>"ValueFilter(=,'binary:value1')"

scan 'tableb', FILTER=>"ValueFilter(=,'binary:value2')"

8、值的覆盖

scan 'tableb'

put 'tableb','rowkey1','cf1:key1','value2'

scan 'tableb'

9、删除一个columnfamily

alter 'tableb',{NAME=>'cf1',METHOD=>'delete'}

10、删除一条数据(rowkey1 in cf1:key1)

delete 'tableb','rowkey1','cf1:key1'

11、删除一个表

disable tableb

drop 'tableb'

list

12、退出hbase shell
exit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值