异常原因分析:
一般来说memstore超过hbase.hregion.memstore.flush.size(默认128M),会flush形成HFile。当写入数据过快时,导致产生大量HFile,
当HFile数量超过配置hbase.hstore.blockingStoreFiles(默认10),hbase会进行compaction(合并)hfile,compaction合并时会阻塞memstore flush操作,
阻塞最长时长hbase.hstore.blockingWaitTime(默认值90000,即90s),当超过该时间后,如果compaction还未完成,memstore flush也会停止阻塞。
但是正是在flush阻塞这段时间内,一直写入导致memstore的大小超过了上限blockingMemStoreSize:
blockingMemStoreSize=hbase.hregion.memstore.flush.size*hbase.hregion.memstore.block.multiplier(默认为4)=512M,
此时,region将拒绝所有写请求,所以客户端抛出RegionTooBusyException,并在一定时间后重试。
问题解决:
修改表的配置,执行如下hbase命令
disable 'UserCredit.tbCreditOperationRecord'
alter 'UserCredit.tbCreditOperationRecord', CONFIGURATION => {'hbase.region.store.parallel.put.limit.min.column.count' => 200,
'hbase.region.store.parallel.put.limit' => 100}
enable 'UserCredit.tbCreditOperationRecord'
这里将hbase.region.store.parallel.put.limit.min.column.count参数,线程处理的最小列数由默认100改为200
将hbase.region.store.parallel.put.limit参数,单region处理的并发数由默认10改为100