hbase增刪改查操做

hbase(main):005:0> list
hbase(main):005:0> help "create"
hbase(main):008:1' create 'user_info', {NAME=>'base_info',VERSIONS=>3},{NAME=>'extra_info'}

=> Hbase::Table - user_info
hbase(main):003:0> put 'user_info','001','base_info:name','fengjie';
hbase(main):004:0* list
0 row(s) in 0.2730 seconds
hbase(main):005:0> put 'user_info','001','base_info:age',28
0 row(s) in 0.0180 seconds

hbase(main):006:0> put 'user_info','001','base_info:addr','newyork'
0 row(s) in 0.0160 seconds

base(main):007:0> put 'user_info','001','extra_info:addr','female'
0 row(s) in 0.0270 seconds

hbase(main):008:0> put 'user_info','001','base_info:phone','138138'
0 row(s) in 0.0200 seconds
hbase(main):013:0> scan 'user_info'
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453116210831, value=fengjie                                    
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female
 
 插入數據後,hbase會給數據進行排序,行健利用字典順序排序,列族利用key進行排序
 
 hbase(main):016:0> get 'user_info' ,'001'
COLUMN                             CELL                                                                                             
 base_info:addr                    timestamp=1453116330696, value=newyork                                                           
 base_info:age                     timestamp=1453116278159, value=28                                                                
 base_info:name                    timestamp=1453116210831, value=fengjie                                                           
 base_info:phone                   timestamp=1453116447397, value=138138                                                            
 extra_info:addr                   timestamp=1453116383154, value=female                                                            
5 row(s) in 0.0430 seconds

hbase(main):017:0> put  'user_info' ,'001' ,'base_info:name','fengfeng'
0 row(s) in 0.0200 seconds
hbase(main):018:0> put  'user_info' ,'001' ,'base_info:name','luoyufeng6~'
0 row(s) in 0.0220 seconds

nfo:addr                    timestamp=1453116330696, value=newyork                                                           
 base_info:age                     timestamp=1453116278159, value=28                                                                
 base_info:name                    timestamp=1453116898848, value=luoyufeng6~                                                       
 base_info:phone                   timestamp=1453116447397, value=138138                                                            
 extra_info:addr                   timestamp=1453116383154, value=female                                                            
5 row(s) in 0.0600 seconds

base(main):021:0> get 'user_info' ,'001' ,{COLUMN=>'base_info:name',VERSIONS=>10}
COLUMN                             CELL                                                                                             
 base_info:name                    timestamp=1453116898848, value=luoyufeng6~                                                       
 base_info:name                    timestamp=1453116856832, value=fengfeng                                                          
 base_info:name                    timestamp=1453116210831, value=fengjie                                                           
3 row(s) in 0.0470 seconds


hbase(main):022:0> put  'user_info' ,'001' ,'base_info:name','FENGBAOBAO'
0 row(s) in 0.0270 seconds

hbase(main):023:0> get 'user_info' ,'001' ,{COLUMN=>'base_info:name',VERSIONS=>10}
COLUMN                             CELL                                                                                             
 base_info:name                    timestamp=1453117097894, value=FENGBAOBAO                                                        
 base_info:name                    timestamp=1453116898848, value=luoyufeng6~                                                       
 base_info:name                    timestamp=1453116856832, value=fengfeng                                                          
3 row(s) in 0.0520 seconds

hbase(main):026:0> scan 'user_info' ,{RAW=>true,VERSIONS=>5}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117097894, value=FENGBAOBAO                                 
 001                               column=base_info:name, timestamp=1453116898848, value=luoyufeng6~                                
 001                               column=base_info:name, timestamp=1453116856832, value=fengfeng                                   
 001                               column=base_info:name, timestamp=1453116210831, value=fengjie                                    
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female  
 
 base(main):028:0> scan 'user_info' ,{RAW=>true,VERSIONS=>5}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:name, timestamp=1453117097894, value=FENGBAOBAO                                 
 001                               column=base_info:name, timestamp=1453116898848, value=luoyufeng6~                                
 001                               column=base_info:name, timestamp=1453116856832, value=fengfeng                                   
 001                               column=base_info:name, timestamp=1453116210831, value=fengjie                                    
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female                                    
1 row(s) in 0.1780 seconds

hbase(main):029:0> scan 'user_info' ,{VERSIONS=>5}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:name, timestamp=1453117097894, value=FENGBAOBAO                                 
 001                               column=base_info:name, timestamp=1453116898848, value=luoyufeng6~                                
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female       
 

ain):030:0> put  'user_info' ,'002' ,'base_info:name','Furong'
hbase(main):031:0> put  'user_info' ,'002' ,'base_info:age','30'
hbase(main):032:0> put  'user_info' ,'002' ,'base_info:addr','beijing'

hbase(main):033:0> scan 'user_info'
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female                                    
 002                               column=base_info:addr, timestamp=1453117653480, value=beijing                                    
 002                               column=base_info:age, timestamp=1453117640213, value=30                                          
 002                               column=base_info:name, timestamp=1453117601510, value=Furong       
 
 e(main):044:0> get 'user_info','002' ,{FILTER=>"ValueFilter(=,'binary:beijing')"}
COLUMN                             CELL                                                                                             
 base_info:addr                    timestamp=1453117653480, value=beijing                                                           
1 row(s) in 0.1620 seconds

hbase(main):046:0> scan 'user_info' ,{STARTROW=>'001',LIMIT=>2}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female                                    
 002                               column=base_info:addr, timestamp=1453117653480, value=beijing                                    
 002                               column=base_info:age, timestamp=1453117640213, value=30                                          
 002                               column=base_info:name, timestamp=1453117601510, value=Furong                                     
2 row(s) in 0.0320 seconds


排序

相關文章
相關標籤/搜索