flume sinks 到hbase 消费数据慢

1、情况:flume   消费数据到habse中。

source 和 channel  都正常,速度很快,唯独sinks 到hbase的时候速度特别慢。大概是一秒存入一条数据 

top 查看flume cpu 飙升至99%

原的配置文件

a1.sources = r1
a1.sinks = k1
a1.channels = c1
 
# Describe/configure the source
a1.sources.r1.type =spooldir 
a1.sources.r1.spoolDir=/urldata/
# 通过以下配置指定消费完成后文件后缀
a1.sources.r1.fileSuffix = .COMPLETED  
a1.sources.r1.checkperiodic = 50

# Describe the sink
 #输入格式,DELIMITED和json
 
a1.sinks.k1.type = hbase
a1.sinks.k1.table = t_url
a1.sinks.k1.columnFamily = info
a1.sinks.k1.serializer = org.apache.flume.sink.hbase.RegexHbaseEventSerializer
##指定列名称,数据的第一列为ROW_KEY
a1.sinks.k1.serializer.colNames = rid,dir,username,sip,sport,dip,dport,bytes,starttime,action,url,descid,domain,type,subtype,words,line,platform,browser,grpids,referer,termtype
a1.sinks.k1.serializer.regex = (.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)







a1.sinks.k1.channel = memoryChannel
 
# Use a channel which buffers events in memory

 #The maximum number of events stored in the channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 100000
a1.channels.c1.transactionCapacity = 10000

#The maximum number of events the channel will take from a source or give to a sink per transaction
 
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
a1.sinks.k1.batchSize = 200

 

解决办法:

是由于匹配正则的表达式太复杂导致 flume在处理数据的时候特别慢。需要优化flume的正则表达式分隔符

a1.sinks.k1.serializer.regex = ([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)\\|([^\\|]*)

 

按照|分割符、分割正则表达式

后续测试数据正常

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

学海无涯苦做java

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值