当生成完成一个HFile后,如果你不想因为出错而重做数据,建议在bulkimport之前,查看一下hfile
hbase提供了一个查看HFile属性的包 org.apache.hadoop.hbase.io.hfile.HFile
$hbase org.apache.hadoop.hbase.io.hfile.HFile
usage: HFile [-a] [-b] [-e] [-f <arg>] [-j] [-k] [-m] [-p] [-r <arg>] [-s
<arg>] [-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
-j,--json Print in JSON format
-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,--seekToRow <arg> Seek to this row and print all the kvs for this
row only
-v,--verbose Verbose output; emits file and meta data
delimiters
例如使用-p打印kv,示例如下
hbase org.apache.hadoop.hbase.io.hfile.HFile -f /home/xxxxx/scan-xxxx-xxxx-xxxx-xxxx/attr/e8b8a5e0d19a4f7ca342d92d50371929 -p
K: http://com.book108.www/search.asp/attr:uniq/1358155195054/Put/vlen=23 V: http://www.book108.com/
K: http://com.book108.www/search.asp?flag=11&flag2=?/attr:uniq/1358155195120/Put/vlen=48 V: http://www.book108.com/search.asp?flag=11&flag2=
K: http://com.book108.www/search.asp?flag=3&flag2=?/attr:uniq/1358155195121/Put/vlen=47 V: http://www.book108.com/search.asp?flag=3&flag2=
K: http://com.book108.www/search.asp?flag=4&flag2=%A7%B3?/attr:uniq/1358155195121/Put/vlen=53 V: http://www.book108.com/search.asp?flag=4&flag2=%A7%B3
K: http://com.book108.www/search.asp?flag=4&flag2=?/attr:uniq/1358155195121/Put/vlen=47 V:
http://www.book108.com/search.asp?flag=4&flag2=
选自HBase权威指南(HBase The Definitive Guide) P331