HBase 查看HFile内容
hbase 查看HFile hbase的数据文件最终存放的是HFile文件,即对MFile存储格式的封装修改,存储的为二进制格式内容,目前hbase提供的hbase org.apache.hadoop.hbase.io.hfile.HFile 工具类可以查看HFile文件内容,对排查region的分布情况有很大用途,以下为查询步骤:
- 定位HFile文件
[hadoop@rm ~]$ hadoop fs -ls /hbase/data/default/TEST/b91a1994accb6e4fc2515aadd74dfc7b/0
15/03/26 17:47:01 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
-rw-r--r-- 3 hadoop supergroup 327313 2015-03-20 22:18 /hbase/data/default/TEST/b91a1994accb6e4fc2515aadd74dfc7b/0/8413bc9aa70342f0a86a7ca7d70568a9
- HFile查看8413bc9aa70342f0a86a7ca7d70568a9 文件
hbase hbase org.apache.hadoop.hbase.io.hfile.HFile -f /hbase/data/default/TEST/b91a1994accb6e4fc2515aadd74dfc7b/0/8413bc9aa70342f0a86a7ca7d70568a9 -p
- 回车即可
- 更多hbase org.apache.hadoop.hbase.io.hfile.HFile 的参数 可以
[hadoop@rm ~]$ /oneapm/local/hbase-0.98.10.1-hadoop2/bin/hbase org.apache.hadoop.hbase.io.hfile.HFile
2015-03-26 17:52:45,338 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
2015-03-26 17:52:45,485 INFO [main] util.ChecksumType: Checksum using org.apache.hadoop.util.PureJavaCrc32
2015-03-26 17:52:45,486 INFO [main] util.ChecksumType: Checksum can use org.apache.hadoop.util.PureJavaCrc32C
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/oneapm/local/hbase-0.98.10.1-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/oneapm/local/hadoop-2.5.2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
2015-03-26 17:52:45,757 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2015-03-26 17:52:46,329 INFO [main] Configuration.deprecation: fs.default.name is deprecated. Instead, use fs.defaultFS
usage: HFile [-a] [-b] [-e] [-f <arg> | -r <arg>] [-h] [-k] [-m] [-p]
[-s] [-v] [-w <arg>]
-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/hbase:meta/12/34
-h,--printblockheaders Print block headers for each block.
-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.
'hbase:meta,,1'
-s,--stats Print statistics
-v,--verbose Verbose output; emits file and meta data
delimiters
-w,--seekToRow <arg> Seek to this row and print all the kvs for this
row only
[hadoop@rm ~]$