zoukankan      html  css  js  c++  java
  • 【HBase】表的version

    建表、添加数据

    Examples:
    
      hbase> create 'ns1:t1', 'f1', SPLITS => ['10', '20', '30', '40']
      hbase> create 't1', 'f1', SPLITS => ['10', '20', '30', '40']
      hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
      hbase> create 't1', {NAME => 'f1', VERSIONS => 5}, METADATA => { 'mykey' => 'myvalue' }
      hbase> # Optionally pre-split the table into NUMREGIONS, using
      hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
      hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}
      hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit', REGION_REPLICATION => 2, CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}}
      hbase> create 't1', {NAME => 'f1', DFS_REPLICATION => 1}
    
    You can also keep around a reference to the created table:
    
      hbase> t1 = create 't1', 'f1'
    
    Which gives you a reference to the table named 't1', on which you can then
    call methods.
    hbase(main):003:0> create 'lzl', 'info', SPLITS => ['10', '20', '30', '40']
    0 row(s) in 2.4090 seconds
    
    => Hbase::Table - lzl
    hbase(main):004:0> put 'lzl','01','info:name','lzl'
    0 row(s) in 0.3180 seconds
    
    hbase(main):005:0> put 'lzl','11','info:name','lzl2'
    0 row(s) in 0.0250 seconds
    
    hbase(main):006:0> put 'lzl','31','info:name','lzl3'
    0 row(s) in 0.0530 seconds
    

    查看版本VERSION => 1

    hbase(main):007:0> describe 'lzl'
    Table lzl is ENABLED                                                                                                                                                                                     
    lzl                                                                                                                                                                                                      
    COLUMN FAMILIES DESCRIPTION                                                                                                                                                                              
    {NAME => 'info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0',
     BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                                                   
    1 row(s) in 0.0690 seconds
    
    hbase(main):008:0> 
    

    新增VERSION => 3

    hbase(main):008:0> alter 'lzl' ,{NAME=>'info', VERSIONS=>3}
    Updating all regions with the new schema...
    0/5 regions updated.
    5/5 regions updated.
    Done.
    0 row(s) in 3.3500 seconds
    
    hbase(main):009:0>
    

    修改数据

    hbase(main):009:0> put 'lzl','01','info:name','hhh'
    0 row(s) in 0.0300 seconds
    
    hbase(main):010:0> scan 'lzl'
    ROW                                                 COLUMN+CELL                                                                                                                                          
     01                                                 column=info:name, timestamp=1570830343144, value=hhh                                                                                                 
     11                                                 column=info:name, timestamp=1570829294234, value=lzl2                                                                                                
     31                                                 column=info:name, timestamp=1570829314499, value=lzl3                                                                                                
    3 row(s) in 0.1660 seconds
    
    hbase(main):011:0> 
    
    

    查看VERSION => 3数据

    hbase(main):019:0> scan 'lzl',{VERSIONS => 1}
    ROW                                                 COLUMN+CELL                                                                                                                                          
     01                                                 column=info:name, timestamp=1570830343144, value=hhh                                                                                                 
     11                                                 column=info:name, timestamp=1570829294234, value=lzl2                                                                                                
     31                                                 column=info:name, timestamp=1570829314499, value=lzl3                                                                                                
    3 row(s) in 0.0660 seconds
    
    hbase(main):020:0> put 'lzl','01','info:name','zzz'
    0 row(s) in 0.0180 seconds
    
    hbase(main):021:0> scan 'lzl',{VERSIONS => 3}
    ROW                                                 COLUMN+CELL                                                                                                                                          
     01                                                 column=info:name, timestamp=1570830773469, value=zzz                                                                                                 
     01                                                 column=info:name, timestamp=1570830343144, value=hhh                                                                                                 
     01                                                 column=info:name, timestamp=1570829280377, value=lzl                                                                                                 
     11                                                 column=info:name, timestamp=1570829294234, value=lzl2                                                                                                
     31                                                 column=info:name, timestamp=1570829314499, value=lzl3                                                                                                
    3 row(s) in 0.0620 seconds
    
    hbase(main):022:0> 
    
    

    HBase会存储最近的3个VERSION

    hbase> create ‘ns1:t1’, ‘f1’, SPLITS => [‘10’, ‘20’, ‘30’, ‘40’]
    按rowkey切分建表, [‘10’, ‘20’, ‘30’, ‘40’]会有5个region
    region均匀分配在regionserver中
    在这里插入图片描述

  • 相关阅读:
    java web的安全约束--表单的验证
    Java web的安全约束--Basic验证
    setExecuteExistingDelayedTasksAfterShutdownPolicy方法与setContinueExistingPeriodicTasksAfterShutdownPolicy方法的比较
    关于scheduleAtFixedRate方法与scheduleWithFixedDelay的使用
    ExecutorService的invokeAny方法
    CompletionService的异常处理
    CompletionService的poll方法
    include指令
    向jsp页面传值时出现乱码
    new home page
  • 原文地址:https://www.cnblogs.com/BIG-BOSS-ZC/p/11807302.html
Copyright © 2011-2022 走看看