zoukankan      html  css  js  c++  java
  • hbase KEEP_DELETED_CELLS及版本问题

    创建表时可以指定保存的版本数,最小版本数和存活时间

    复制代码
    $hbase>create 'ns1:t3',{NAME=>'f1',VERSIONS=>5}
    //1.指定时间片精确查询
    $hbase>get ‘ns1:t3’,’row1’,{COLUMN=>’f1:name’,TIMESTAMP=>1234}
     
    //2. 指定时间区间精确查询,默认查询区域内最新版本值。
    // 区间查询是前包后不包.
    $hbase>get ‘ns1:t3’,’row1’,{COLUMN=>’f1:name’,TIMERANGE=>[ts1,ts2]}
     
    //3.指定版本数进行查询
    $hbase>get ‘ns1:t3’,’row1’,{COLUMN=>’f1:name’,TIMERANGE=>[ts1,ts2],VERSIONS=>4}
    复制代码

    KEEP_DELETED_CELLS:删除后是否保持数据

    建表时可以指定该参数

    1.KEEP_DELETED_CELLS为false

    复制代码

    hbase(main):013:0> desc 'test'
    Table test is ENABLED
    test
    COLUMN FAMILIES DESCRIPTION
    {NAME => 'e', BLOOMFILTER => 'ROW', VERSIONS => '2147483647', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCO
    DING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICAT
    ION_SCOPE => '0'}
    1 row(s) in 0.0370 seconds

    hbase(main):003:0> scan 'test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     r1                               column=e:c1, timestamp=14, value=value
     r1                               column=e:c1, timestamp=12, value=value
     r1                               column=e:c1, timestamp=10, value=value
    1 row(s) in 0.1720 seconds

    hbase(main):004:0> delete 'test','r1','e:c1',11
    0 row(s) in 0.3320 seconds

    hbase(main):005:0> scan 'test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     r1                               column=e:c1, timestamp=14, value=value
     r1                               column=e:c1, timestamp=12, value=value
     r1                               column=e:c1, timestamp=11, type=DeleteColumn
     r1                               column=e:c1, timestamp=10, value=value
    1 row(s) in 0.0370 seconds

    hbase(main):006:0> flush 'test'
    0 row(s) in 0.8070 seconds

    hbase(main):007:0> scan 'test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     r1                               column=e:c1, timestamp=14, value=value
     r1                               column=e:c1, timestamp=12, value=value
     r1                               column=e:c1, timestamp=11, type=DeleteColumn
    1 row(s) in 0.0370 seconds

    hbase(main):008:0> major_compact 'test'
    0 row(s) in 0.1250 seconds

    hbase(main):009:0> scan 'test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     r1                               column=e:c1, timestamp=14, value=value
     r1                               column=e:c1, timestamp=12, value=value
    1 row(s) in 0.0320 seconds

    复制代码

    2.KEEP_DELETED_CELLS为true

    复制代码
    hbase(main):016:0> desc 'ns1:test'
    Table ns1:test is ENABLED
    ns1:test
    COLUMN FAMILIES DESCRIPTION
    {NAME => 'e', BLOOMFILTER => 'ROW', VERSIONS => '2147483647', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'TRUE', DATA_BLOCK_ENCOD
    ING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATI
    ON_SCOPE => '0'}
    1 row(s) in 0.0450 seconds
    
    hbase(main):017:0> scan 'ns1:test'
    ROW                               COLUMN+CELL
    0 row(s) in 0.0200 seconds
    
    hbase(main):018:0> put 'ns1:test','row1','e:name','tom',10
    0 row(s) in 0.1200 seconds
    
    hbase(main):019:0> put 'ns1:test','row1','e:name','tom',12
    0 row(s) in 0.0160 seconds
    
    hbase(main):020:0> put 'ns1:test','row1','e:name','tom',14
    0 row(s) in 0.0240 seconds
    
    hbase(main):021:0> scan 'ns1:test'
    ROW                               COLUMN+CELL
     row1                             column=e:name, timestamp=14, value=tom
    1 row(s) in 0.0180 seconds
    
    hbase(main):022:0> scan 'ns1:test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     row1                             column=e:name, timestamp=14, value=tom
     row1                             column=e:name, timestamp=12, value=tom
     row1                             column=e:name, timestamp=10, value=tom
    1 row(s) in 0.0530 seconds
    
    hbase(main):023:0> delete 'ns1:test','row1','e:name',11
    0 row(s) in 0.0870 seconds
    
    hbase(main):024:0> scan 'ns1:test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     row1                             column=e:name, timestamp=14, value=tom
     row1                             column=e:name, timestamp=12, value=tom
     row1                             column=e:name, timestamp=11, type=DeleteColumn
     row1                             column=e:name, timestamp=10, value=tom
    1 row(s) in 0.1430 seconds
    
    hbase(main):025:0> flush 'ns1:test'
    0 row(s) in 0.4320 seconds
    
    hbase(main):026:0> scan 'ns1:test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     row1                             column=e:name, timestamp=14, value=tom
     row1                             column=e:name, timestamp=12, value=tom
     row1                             column=e:name, timestamp=11, type=DeleteColumn
     row1                             column=e:name, timestamp=10, value=tom
    1 row(s) in 0.0340 seconds
    
    hbase(main):027:0> major_compact 'ns1:test'
    0 row(s) in 0.1890 seconds
    
    hbase(main):028:0> scan 'ns1:test',{RAW=>true,VERSIONS=>10}
    ROW                               COLUMN+CELL
     row1                             column=e:name, timestamp=14, value=tom
     row1                             column=e:name, timestamp=12, value=tom
     row1                             column=e:name, timestamp=11, type=DeleteColumn
     row1                             column=e:name, timestamp=10, value=tom
    1 row(s) in 0.0420 seconds
    
    hbase(main):029:0>
    复制代码
  • 相关阅读:
    记一次cdh6.3.2版本spark写入phoniex的错误:Incompatible jars detected between client and server. Ensure that phoenix-[version]-server.jar is put on the classpath of HBase in every region server:
    kylin的除法函数的坑
    Exception:kylin构建cube, Cannot modify mapReduce.queue.name at runtime
    cdh版本 livy部署
    kylin-3.1.1-bin-hadoop3搭建,构建cube报的错误,Cannot modify dfs.replication at runtime. It is not in list of params that are allowed to be modified at runtime
    apache开源 国内镜像地址
    一次phoniex表查询报出 org.apache.hadoop.hbase.NotServingRegionException
    spark高级分析2的数据集地址
    题解 P4240【毒瘤之神的考验】
    题解 P4688/BZOJ4939 【[Ynoi2016] 掉进兔子洞】
  • 原文地址:https://www.cnblogs.com/gaohuajie/p/12917718.html
Copyright © 2011-2022 走看看