使用命令方式批量录入
hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles hdfs://hadooptest-11-63:9000/hfimport/1345442109471 tablename
使用API方式录入
HTable table = new HTable(getConf(), HTABLE_NAME);
if (table != null) {
LoadIncrementalHFiles loader = new LoadIncrementalHFiles(getConf());
loader.doBulkLoad(outputPath, table);
table.close();
}
曾经担心有一种情况,当生成HFile以后,Region的分布改变,再执行bulk.load操作会不会不成功? 从代码和实验两方面来看,这个担心是不需要的,代码有处理这种情况,如果出现Region改变会split HFile 有兴趣可以看Hbase bulkload源代码分析
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)