Hbase shell 命令详解

10 篇文章 0 订阅
6 篇文章 0 订阅

安装好hbase后,执行hbase shell,进入hbase shell命令行:

1,建立一个表student:

hbase(main):030:0> create 'student','grade','course'
0 row(s) in 0.6060 seconds

hbase(main):031:0>

 

2,查看hbase中表,有scores、student、test三个表:

hbase(main):031:0> list
TABLE                                                                                                                 
scores                                                                                                                
student                                                                                                               
test                                                                                                                  
3 row(s) in 0.0340 seconds

 

3,查看student表构造:

hbase(main):032:0> describe 'student'
DESCRIPTION                                                                   ENABLED                                 
 {NAME => 'student', FAMILIES => [{NAME => 'course', BLOOMFILTER => 'NONE', R true                                    
 EPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '3', TTL => '214                                         
 7483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'},                                         
  {NAME => 'grade', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESS                                         
 ION => 'NONE', VERSIONS => '3', TTL => '2147483647', BLOCKSIZE => '65536', I                                         
 N_MEMORY => 'false', BLOCKCACHE => 'true'}]}                                                                         
1 row(s) in 0.1080 seconds

4,加入一行,Ann的grade是2

hbase(main):033:0> put 'student','Ann','grade:','2'
0 row(s) in 0.0480 seconds

 

5,给Ann的这行,cource列族加入math 87

hbase(main):034:0> put 'student','Ann','course:math','87'
0 row(s) in 0.0580 seconds

6,给Ann的这行,cource的列族加入art 90

hbase(main):035:0> put 'student','Ann','course:art','90'
0 row(s) in 0.0470 seconds

 

7,查看student表中,Ann的数据

hbase(main):038:0> get 'student','Ann'
COLUMN                         CELL                                                                                   
 course:art                    timestamp=1398771395590, value=90                                                      
 course:math                   timestamp=1398771275653, value=87                                                      
 grade:                        timestamp=1398771189743, value=2                                                       
3 row(s) in 0.0490 seconds

 

8,查看student表中所有数据

hbase(main):039:0> scan 'student'
ROW                            COLUMN+CELL                                                                            
 Amy                           column=course:art, timestamp=1398771472502, value=86                                   
 Amy                           column=course:math, timestamp=1398771483251, value=76                                  
 Ann                           column=course:art, timestamp=1398771395590, value=90                                   
 Ann                           column=course:math, timestamp=1398771275653, value=87                                  
 Ann                           column=grade:, timestamp=1398771189743, value=2                                        
2 row(s) in 0.0680 seconds

9,删除一个表

disable 'student'

drop 'student'

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值