Hbase架构 Hbase Region的拆分和合并

Hbase架构  

Hbase架构 Hbase Region的拆分和合并_第1张图片

 Hbase Region的拆分和合并

对命令不熟查看帮助文档

help 'split'

hbase(main):035:0> scan 'hbase:meta'
ROW                            COLUMN+CELL                                                                                                                                                                                           
 t1,,1530806198356.7f0f2d9ea8d column=info:regioninfo, timestamp=1530806199040, value={ENCODED => 7f0f2d9ea8d2274067b8
 2274067b881ffa2858201.        81ffa2858201, NAME => 't1,,1530806198356.7f0f2d9ea8d2274067b881ffa2858201.', STARTKEY =
                               > '', ENDKEY => ''}                                                                    
 t1,,1530806198356.7f0f2d9ea8d column=info:seqnumDuringOpen, timestamp=1530806199040, value=\x00\x00\x00\x00\x00\x00\x
 2274067b881ffa2858201.        00\x02                                                                                 
 t1,,1530806198356.7f0f2d9ea8d column=info:server, timestamp=1530806199040, value=slave1:16020                        
 2274067b881ffa2858201.                                                                                               
 t1,,1530806198356.7f0f2d9ea8d column=info:serverstartcode, timestamp=1530806199040, value=1530800858694              
 2274067b881ffa2858201.  
区域切割

hbase(main):036:0> split 't1','row5'
hbase(main):037:0> scan 'hbase:meta'
ROW                            COLUMN+CELL                                                                                                                                                                                         
 t1,,1530806198356.7f0f2d9ea8d column=info:regioninfo, timestamp=1530806548876, value={ENCODED => 7f0f2d9ea8d2274067b8
 2274067b881ffa2858201.        81ffa2858201, NAME => 't1,,1530806198356.7f0f2d9ea8d2274067b881ffa2858201.', STARTKEY =
                               > '', ENDKEY => '', OFFLINE => true, SPLIT => true}                                    
 t1,,1530806198356.7f0f2d9ea8d column=info:seqnumDuringOpen, timestamp=1530806199040, value=\x00\x00\x00\x00\x00\x00\x
 2274067b881ffa2858201.        00\x02                                                                                 
 t1,,1530806198356.7f0f2d9ea8d column=info:server, timestamp=1530806199040, value=slave1:16020                        
 2274067b881ffa2858201.                                                                                               
 t1,,1530806198356.7f0f2d9ea8d column=info:serverstartcode, timestamp=1530806199040, value=1530800858694              
 2274067b881ffa2858201.                                                                                               
 t1,,1530806198356.7f0f2d9ea8d column=info:splitA, timestamp=1530806548876, value={ENCODED => fd3edcb4a6a379e1d02a09bf
 2274067b881ffa2858201.        fb2c000e, NAME => 't1,,1530806548546.fd3edcb4a6a379e1d02a09bffb2c000e.', STARTKEY => ''
                               , ENDKEY => 'row5'}                                                                    
 t1,,1530806198356.7f0f2d9ea8d column=info:splitB, timestamp=1530806548876, value={ENCODED => 8d9e7d15ef84880fe64fee29
 2274067b881ffa2858201.        e9f963c9, NAME => 't1,row5,1530806548546.8d9e7d15ef84880fe64fee29e9f963c9.', STARTKEY =
                               > 'row5', ENDKEY => ''}                                                                
 t1,,1530806548546.fd3edcb4a6a column=info:regioninfo, timestamp=1530806548996, value={ENCODED => fd3edcb4a6a379e1d02a
 379e1d02a09bffb2c000e.        09bffb2c000e, NAME => 't1,,1530806548546.fd3edcb4a6a379e1d02a09bffb2c000e.', STARTKEY =
                               > '', ENDKEY => 'row5'}                                                                
 t1,,1530806548546.fd3edcb4a6a column=info:seqnumDuringOpen, timestamp=1530806548996, value=\x00\x00\x00\x00\x00\x00\x
 379e1d02a09bffb2c000e.        00\x10                                                                                 
 t1,,1530806548546.fd3edcb4a6a column=info:server, timestamp=1530806548996, value=slave1:16020                        
 379e1d02a09bffb2c000e.                                                                                               
 t1,,1530806548546.fd3edcb4a6a column=info:serverstartcode, timestamp=1530806548996, value=1530800858694              
 379e1d02a09bffb2c000e.                                                                                               
 t1,row5,1530806548546.8d9e7d1 column=info:regioninfo, timestamp=1530806548990, value={ENCODED => 8d9e7d15ef84880fe64f
 5ef84880fe64fee29e9f963c9.    ee29e9f963c9, NAME => 't1,row5,1530806548546.8d9e7d15ef84880fe64fee29e9f963c9.', STARTK
                               EY => 'row5', ENDKEY => ''}                                                            
 t1,row5,1530806548546.8d9e7d1 column=info:seqnumDuringOpen, timestamp=1530806548990, value=\x00\x00\x00\x00\x00\x00\x
 5ef84880fe64fee29e9f963c9.    00\x11                                                                                 
 t1,row5,1530806548546.8d9e7d1 column=info:server, timestamp=1530806548990, value=slave1:16020                        
 5ef84880fe64fee29e9f963c9.                                                                                           
 t1,row5,1530806548546.8d9e7d1 column=info:serverstartcode, timestamp=1530806548990, value=1530800858694              
 5ef84880fe64fee29e9f963c9.                                                                                           
4 row(s) in 0.0760 seconds


合并区域

help 'merge_region'

hbase(main):002:0> merge_region 'fd3edcb4a6a379e1d02a09bffb2c000e','8d9e7d15ef84880fe64fee29e9f963c9'
hbase(main):003:0> scan 'hbase:meta'
ROW                            COLUMN+CELL                                                                                                                                                                                        
 t1,,1530807155134.02a60a9ae01 column=info:mergeA, timestamp=1530807155366, value=PBUF\x08\xC2\xF0\xB8\xD9\xC6,\x12\x0
 9186e39f825a13f75e52c.        D\x0A\x07default\x12\x02t1\x1A\x00"\x04row5(\x000\x008\x00                             
 t1,,1530807155134.02a60a9ae01 column=info:mergeB, timestamp=1530807155366, value=PBUF\x08\xC2\xF0\xB8\xD9\xC6,\x12\x0
 9186e39f825a13f75e52c.        D\x0A\x07default\x12\x02t1\x1A\x04row5"\x00(\x000\x008\x00                             
 t1,,1530807155134.02a60a9ae01 column=info:regioninfo, timestamp=1530807155457, value={ENCODED => 02a60a9ae019186e39f8
 9186e39f825a13f75e52c.        25a13f75e52c, NAME => 't1,,1530807155134.02a60a9ae019186e39f825a13f75e52c.', STARTKEY =
                               > '', ENDKEY => ''}                                                                    
 t1,,1530807155134.02a60a9ae01 column=info:seqnumDuringOpen, timestamp=1530807155457, value=\x00\x00\x00\x00\x00\x00\x
 9186e39f825a13f75e52c.        00\x12                                                                                 
 t1,,1530807155134.02a60a9ae01 column=info:server, timestamp=1530807155457, value=slave1:16020                        
 9186e39f825a13f75e52c.                                                                                               
 t1,,1530807155134.02a60a9ae01 column=info:serverstartcode, timestamp=1530807155457, value=1530800858694              
 9186e39f825a13f75e52c.                                                                                             



查看表中的数据scan

hbase(main):004:0> scan 't1'
ROW                            COLUMN+CELL                                                                            
 row1                          column=f1:name, timestamp=1530806250885, value=jhy                                     
 row10                         column=f1:age, timestamp=1530806398543, value=15                                       
 row2                          column=f1:age, timestamp=1530806285995, value=11                                       
 row3                          column=f1:name, timestamp=1530806304461, value=jq                                      
 row4                          column=f1:age, timestamp=1530806319056, value=12                                       
 row5                          column=f1:age, timestamp=1530806327636, value=13                                       
 row6                          column=f1:name, timestamp=1530806339104, value=je                                      
 row7                          column=f1:name, timestamp=1530806355273, value=jr                                      
 row8                          column=f1:age, timestamp=1530806365521, value=14                                       
 row9                          column=f1:name, timestamp=1530806376306, value=jt  


数据格式整理前:

 hbase:namespace,,152984229398 column=info:regioninfo, timestamp=1530800884101, value={ENCODED => 619ca07293413505238b
 5.619ca07293413505238b9027287 9027287604f5, NAME => 'hbase:namespace,,1529842293985.619ca07293413505238b9027287604f5.
 604f5.                        ', STARTKEY => '', ENDKEY => ''}                                                       
 hbase:namespace,,152984229398 column=info:seqnumDuringOpen, timestamp=1530800884101, value=\x00\x00\x00\x00\x00\x00\x
 5.619ca07293413505238b9027287 00                                                                                     
 604f5.                                                                                                               
 hbase:namespace,,152984229398 column=info:server, timestamp=1530800884101, value=master:16020                        
 5.619ca07293413505238b9027287                                                                                        
 604f5.                                                                                                               
 hbase:namespace,,152984229398 column=info:serverstartcode, timestamp=1530800884101, value=1530800863510              
 5.619ca07293413505238b9027287                                                                                        
 604f5.   

数据整理后:

 hbase:namespace,,1529842293985.619ca07293413505238b9027287604f5. column=info:regioninfo, 
								  timestamp=1530800884101, 
								  value={ENCODED => 619ca07293413505238b9027287604f5, 
								  NAME => 'hbase:namespace,,1529842293985.619ca07293413505238b9027287604f5.', 
								  STARTKEY => '', 
								  ENDKEY => ''}                                                       
 hbase:namespace,,1529842293985.619ca07293413505238b9027287604f5. column=info:seqnumDuringOpen, 
								  timestamp=1530800884101, 
							          value=\x00\x00\x00\x00\x00\x00\x00                                                                                     
                                                                                                                
 hbase:namespace,,1529842293985.619ca07293413505238b9027287604f5. column=info:server, 
								  timestamp=1530800884101, 
								  value=master:16020                        
                                                                                         
                                                                                                                
 hbase:namespace,,1529842293985.619ca07293413505238b9027287604f5. column=info:serverstartcode, 
								  timestamp=1530800884101, 
								  value=1530800863510   

你可能感兴趣的:(hbase)