最近在项目中碰到需要使用spark加载海量数据到hbase的需求,一开始我们使用批量put的方式,这种方式简单,但是带来了一系列的性能问题,一方面速度比较慢,另一方面,由于我们的hbase用来提供oltp服务,导致在加载数据的时候,hbase的region sever频繁GC,严重影响线上交易的响应时间。因此,我们决定使用bulkload的方式来解决这个问题,一路踩坑,终于解决了所有问题,现将遇到的问题总结如下,以备查询。
1、生成hfile文件
生成hfile文件的方法,在网上很多帖子都有讲,这里就不再赘述了,只说说碰到的问题
问题一:
java.io.IOException: Non-increasing Bloom keys: 201301025200000000000003520000000000000500 after 201311195100000000000000010000000000001600
at org.apache.hadoop.hbase.regionserver.StoreFile$Writer.appendGeneralBloomfilter(StoreFile.java:869)
at org.apache.hadoop.hbase.regionserver.StoreFile$Writer.append(StoreFile.java:905)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat$1.write(HFileOutputFormat.java:180)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat$1.write(HFileOutputFormat.java:136)