欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

初试Hbase

程序员文章站 2022-06-03 21:04:43
...

初试Hbase 1. 进入 shell hbase shell 2. 查看所有库 list 3. 查看表结构 describe userInfo DESCRIPTION ENABLED {NAME = userInfo, FAMILIES = [{NAME = m, DATA_BLOCK_ENCODING = NONE, BLOOMFILTER = NONE, true REPLICATION_SCOPE = 0, VERSIONS = 3, C

初试Hbase

1. 进入 shell

hbase shell

2. 查看所有库

list

3. 查看表结构

     describe 'userInfo' 
DESCRIPTION                                                                                            ENABLED                                                
 {NAME => 'userInfo', FAMILIES => [{NAME => 'm', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', true                                                   
  REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '21474                                                        
 83647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK =>                                                         
 'true', BLOCKCACHE => 'true'}]}     

4. 查询

     scan 'userInfo' , {LIMIT => 20}  ## 必须大写 
     get 'userInfo' ,'10001949' 

hbase(main):005:0> get 'userInfo' ,'17335912' 
COLUMN                                   CELL                                                                                                                 
 m:fansNum                               timestamp=1368898063007, value=21                                                                                   
 m:followGroupNum                        timestamp=1368992878152, value=11                                                                                    
 m:followNum                             timestamp=1368813940821, value=28                                                                                    
 m:goodsNum                              timestamp=1369239409259, value=77                                                                                    
 m:groupNum                              timestamp=1368989899011, value=9                                                                                     
 m:heartNum                              timestamp=1369239220703, value=248                                                                                   
 m:ilikeNum                              timestamp=1369239409259, value=110                                                                                   
 m:imageNum                              timestamp=1369239409259, value=16                                                                                    
 m:relayNum                              timestamp=1369239409259, value=405                                                                                  
 m:replyNum                              timestamp=1369239409259, value=11