追踪hfile的读方法:
大家都知道 使用hbase hfile -p hfile文件路径是可以查看hfile中的key value的,我们来看一下hfile的读取用到了那个类。
1. 追踪hbase这个shell,得到:
elif [ "$COMMAND" = "hfile" ] ; then
CLASS='org.apache.hadoop.hbase.io.hfile.HFile'
我们看到 具体执行hfile相关的类是在org.apache.hadoop.hbase.io.hfile.HFile 中
2. 打开org.apache.hadoop.hbase.io.hfile.HFile中的main函数:
public static void main(String[] args) throws IOException {
HFilePrettyPrinter prettyPrinter = new HFilePrettyPrinter();
System.exit(prettyPrinter.run(args));
}
看到具体的执行由HFilePrettyPrinter执行。
打开org.apache.hadoop.hbase.io.hfile.HFilePrettyPrinter
public int run(String[] args) {
conf = HBaseConfiguration.create();
try {
FSUtils.s