zoukankan      html  css  js  c++  java
  • hbase 查看hfile文件

    emp表数据结构

    hbase(main):098:0> scan 'emp'
    ROW                                                              COLUMN+CELL                                                                                                                                                                                 
     row1                                                            column=mycf:depart, timestamp=1555846776542, value=research                                                                                                                                 
     row1                                                            column=mycf:id, timestamp=1555846776590, value=7876                                                                                                                                         
     row1                                                            column=mycf:job, timestamp=1555846776566, value=clerk                                                                                                                                       
     row1                                                            column=mycf:locate, timestamp=1555846776618, value=dallas                                                                                                                                   
     row1                                                            column=mycf:name, timestamp=1555846776511, value=adams                                                                                                                                      
     row2                                                            column=mycf:depart, timestamp=1555846776687, value=sales                                                                                                                                    
     row2                                                            column=mycf:id, timestamp=1555846776736, value=7499                                                                                                                                         
     row2                                                            column=mycf:job, timestamp=1555846776712, value=salesman                                                                                                                                    
     row2                                                            column=mycf:locate, timestamp=1555846776770, value=chicago                                                                                                                                  
     row2                                                            column=mycf:name, timestamp=1555846776662, value=allen                                                                                                                                      
     row3                                                            column=mycf:depart, timestamp=1555846776838, value=sales                                                                                                                                    
     row3                                                            column=mycf:id, timestamp=1555846776887, value=7698                                                                                                                                         
     row3                                                            column=mycf:job, timestamp=1555846776863, value=manager                                                                                                                                     
     row3                                                            column=mycf:locate, timestamp=1555846776912, value=chicago                                                                                                                                  
     row3                                                            column=mycf:name, timestamp=1555846776806, value=blake                                                                                                                                      
     row4                                                            column=mycf:depart, timestamp=1555846776976, value=accounting                                                                                                                               
     row4                                                            column=mycf:id, timestamp=1555846777027, value=7782                                                                                                                                         
     row4                                                            column=mycf:job, timestamp=1555846777002, value=manager                                                                                                                                     
     row4                                                            column=mycf:locate, timestamp=1555846777086, value=new york                                                                                                                                 
     row4                                                            column=mycf:name, timestamp=1555846776952, value=clark                                                                                                                                      
     row5                                                            column=mycf:depart, timestamp=1555846777146, value=research                                                                                                                                 
     row5                                                            column=mycf:id, timestamp=1555846777193, value=7902                                                                                                                                         
     row5                                                            column=mycf:job, timestamp=1555846777169, value=analyst                                                                                                                                     
     row5                                                            column=mycf:locate, timestamp=1555846777218, value=dallas                                                                                                                                   
     row5                                                            column=mycf:name, timestamp=1555846777121, value=ford                                                                                                                                       
     row6                                                            column=mycf:depart, timestamp=1555846777277, value=sales                                                                                                                                    
     row6                                                            column=mycf:id, timestamp=1555846777324, value=7900                                                                                                                                         
     row6                                                            column=mycf:job, timestamp=1555846777301, value=clerk                                                                                                                                       
     row6                                                            column=mycf:locate, timestamp=1555846777355, value=chicago                                                                                                                                  
     row6                                                            column=mycf:name, timestamp=1555846777253, value=james                                                                                                                                      
     row7                                                            column=mycf:depart, timestamp=1555846777416, value=research                                                                                                                                 
     row7                                                            column=mycf:id, timestamp=1555846777465, value=7566                                                                                                                                         
     row7                                                            column=mycf:job, timestamp=1555846777441, value=manager                                                                                                                                     
     row7                                                            column=mycf:locate, timestamp=1555846777491, value=dallas                                                                                                                                   
     row7                                                            column=mycf:name, timestamp=1555846777390, value=jones                                                                                                                                      
     row8                                                            column=mycf:depart, timestamp=1555846777556, value=accounting                                                                                                                               
     row8                                                            column=mycf:id, timestamp=1555846777604, value=7839                                                                                                                                         
     row8                                                            column=mycf:job, timestamp=1555846777581, value=president                                                                                                                                   
     row8                                                            column=mycf:locate, timestamp=1555846777628, value=new york                                                                                                                                 
     row8                                                            column=mycf:name, timestamp=1555846777526, value=king                                                                                                                                       
    8 row(s) in 0.0490 seconds

    工具

    org.apache.hadoop.hbase.io.hfile.HFile

    # hbase org.apache.hadoop.hbase.io.hfile.HFile
    usage: HFile [-a] [-b] [-e] [-f <arg>] [-k] [-m] [-p] [-r <arg>] [-s] [-v]
     -a,--checkfamily    Enable family check
     -b,--printblocks    Print block index meta data
     -e,--printkey       Print keys
     -f,--file <arg>     File to scan. Pass full-path; e.g.
                         hdfs://a:9000/hbase/.META./12/34
     -k,--checkrow       Enable row order check; looks for out-of-order keys
     -m,--printmeta      Print meta data of file
     -p,--printkv        Print key/value pairs
     -r,--region <arg>   Region to scan. Pass region name; e.g. '.META.,,1'
     -s,--stats          Print statistics
     -v,--verbose        Verbose output; emits file and meta data delimiters

    或者

    # hbase hfile
    usage: HFile [-a] [-b] [-e] [-f <arg>] [-k] [-m] [-p] [-r <arg>] [-s] [-v]
     -a,--checkfamily    Enable family check
     -b,--printblocks    Print block index meta data
     -e,--printkey       Print keys
     -f,--file <arg>     File to scan. Pass full-path; e.g.
                         hdfs://a:9000/hbase/.META./12/34
     -k,--checkrow       Enable row order check; looks for out-of-order keys
     -m,--printmeta      Print meta data of file
     -p,--printkv        Print key/value pairs
     -r,--region <arg>   Region to scan. Pass region name; e.g. '.META.,,1'
     -s,--stats          Print statistics
     -v,--verbose        Verbose output; emits file and meta data delimiters
    # hbase org.apache.hadoop.hbase.io.hfile.HFile -f /hbase/emp/2dddf0f7140e120718b6d4356dfcee85/mycf/cab01eb30627452e8e38defad2144996 -e -p -m -s
    19/05/10 21:39:27 INFO hfile.CacheConfig: Allocating LruBlockCache with maximum size 511.0m
    K: row1/mycf:depart/1555846776542/Put/vlen=8 V: research
    K: row1/mycf:id/1555846776590/Put/vlen=4 V: 7876
    K: row1/mycf:job/1555846776566/Put/vlen=5 V: clerk
    K: row1/mycf:locate/1555846776618/Put/vlen=6 V: dallas
    K: row1/mycf:name/1555846776511/Put/vlen=5 V: adams
    K: row2/mycf:depart/1555846776687/Put/vlen=5 V: sales
    K: row2/mycf:id/1555846776736/Put/vlen=4 V: 7499
    K: row2/mycf:job/1555846776712/Put/vlen=8 V: salesman
    K: row2/mycf:locate/1555846776770/Put/vlen=7 V: chicago
    K: row2/mycf:name/1555846776662/Put/vlen=5 V: allen
    K: row3/mycf:depart/1555846776838/Put/vlen=5 V: sales
    K: row3/mycf:id/1555846776887/Put/vlen=4 V: 7698
    K: row3/mycf:job/1555846776863/Put/vlen=7 V: manager
    K: row3/mycf:locate/1555846776912/Put/vlen=7 V: chicago
    K: row3/mycf:name/1555846776806/Put/vlen=5 V: blake
    K: row4/mycf:depart/1555846776976/Put/vlen=10 V: accounting
    K: row4/mycf:id/1555846777027/Put/vlen=4 V: 7782
    K: row4/mycf:job/1555846777002/Put/vlen=7 V: manager
    K: row4/mycf:locate/1555846777086/Put/vlen=8 V: new york
    K: row4/mycf:name/1555846776952/Put/vlen=5 V: clark
    K: row5/mycf:depart/1555846777146/Put/vlen=8 V: research
    K: row5/mycf:id/1555846777193/Put/vlen=4 V: 7902
    K: row5/mycf:job/1555846777169/Put/vlen=7 V: analyst
    K: row5/mycf:locate/1555846777218/Put/vlen=6 V: dallas
    K: row5/mycf:name/1555846777121/Put/vlen=4 V: ford
    K: row6/mycf:depart/1555846777277/Put/vlen=5 V: sales
    K: row6/mycf:id/1555846777324/Put/vlen=4 V: 7900
    K: row6/mycf:job/1555846777301/Put/vlen=5 V: clerk
    K: row6/mycf:locate/1555846777355/Put/vlen=7 V: chicago
    K: row6/mycf:name/1555846777253/Put/vlen=5 V: james
    K: row7/mycf:depart/1555846777416/Put/vlen=8 V: research
    K: row7/mycf:id/1555846777465/Put/vlen=4 V: 7566
    K: row7/mycf:job/1555846777441/Put/vlen=7 V: manager
    K: row7/mycf:locate/1555846777491/Put/vlen=6 V: dallas
    K: row7/mycf:name/1555846777390/Put/vlen=5 V: jones
    K: row8/mycf:depart/1555846777556/Put/vlen=10 V: accounting
    K: row8/mycf:id/1555846777604/Put/vlen=4 V: 7839
    K: row8/mycf:job/1555846777581/Put/vlen=9 V: president
    K: row8/mycf:locate/1555846777628/Put/vlen=8 V: new york
    K: row8/mycf:name/1555846777526/Put/vlen=4 V: king
    Block index size as per heapsize: 416
    reader=/hbase/emp/2dddf0f7140e120718b6d4356dfcee85/mycf/cab01eb30627452e8e38defad2144996,
        compression=none,
        cacheConf=CacheConfig:enabled [cacheDataOnRead=true] [cacheDataOnWrite=false] [cacheIndexesOnWrite=false] [cacheBloomsOnWrite=false] [cacheEvictOnClose=false] [cacheCompressed=false],
        firstKey=row1/mycf:depart/1555846776542/Put,
        lastKey=row8/mycf:name/1555846777526/Put,
        avgKeyLen=24,
        avgValueLen=5,
        entries=40,
        length=2155
    Trailer:
        fileinfoOffset=1678,
        loadOnOpenDataOffset=1591,
        dataIndexCount=1,
        metaIndexCount=0,
        totalUncomressedBytes=2092,
        entryCount=40,
        compressionCodec=NONE,
        uncompressedDataIndexSize=39,
        numDataIndexLevels=1,
        firstDataBlockOffset=0,
        lastDataBlockOffset=0,
        comparatorClassName=org.apache.hadoop.hbase.KeyValue$KeyComparator,
        version=2
    Fileinfo:
        KEY_VALUE_VERSION = x00x00x00x01
        MAJOR_COMPACTION_KEY = x00
        MAX_MEMSTORE_TS_KEY = x00x00x00x00x00x00x00x00
        MAX_SEQ_ID_KEY = 7099
        TIMERANGE = 1555846776511....1555846777628
        hfile.AVG_KEY_LEN = 24
        hfile.AVG_VALUE_LEN = 5
        hfile.LASTKEY = x00x04row8x04mycfnamex00x00x01j?xB1xCAxB6x04
    Mid-key: x00x04row1x04mycfdepartx00x00x01j?xB1xC6xDEx04
    Bloom filter:
        Not present
    Stats:
    Key length: count: 40    min: 22    max: 26    mean: 24.2
    Val length: count: 40    min: 4    max: 10    mean: 5.975
    Row size (bytes): count: 8    min: 187    max: 196    mean: 190.875
    Row size (columns): count: 8    min: 5    max: 5    mean: 5.0
    Key of biggest row: row8
    Scanned kv count -> 40
  • 相关阅读:
    串口通信中接收数据时延迟处理与缓存处理的解决方案(C#)
    串口通讯接收数据的处理
    在C#程序设计中使用Win32类库
    C# Mutex对象学习经验
    我眼中的C# 3.0 Written by Allen Lee
    利用C#鼠标拖动TreeView节点
    richtextbox内文字自动滚动的例子
    在十六进制字符串与数值类型之间转换 C# 编程指南
    如何:指定符号位置和加载行为
    杂记20110321
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/10846883.html
Copyright © 2011-2022 走看看