Flume拦截器

本文探讨了Flume拦截器在处理大数据流时的作用,特别是针对非JSON格式的数据过滤。在第一层Flume中,使用taildir source配合自定义拦截器排除非JSON数据,并利用kafka channel优化效率。而在kafka 1.6和1.7版本中,针对channel存在的不同问题进行了说明。第二层Flume采用kafka source和时间戳拦截器解决零点漂移问题,并通过file Channel将数据写入HDFS,配置useLocalTimeStamp和codec确保文件按照时间戳落盘并选择合适的压缩格式。
摘要由CSDN通过智能技术生成

关于Flume拦截器的问题:

​ flume官方文档:https://flume.apache.org/documentation.html

​ 当我们采用flume - kafka - flume的中间件:

第一层flume:

#为各组件命名
a1.sources = r1
a1.channels = c1

#描述source
a1.sources.r1.type = TAILDIR
a1.sources.r1.filegroups = f1
a1.sources.r1.filegroups.f1 = /opt/module/applog/log/app.*
a1.sources.r1.positionFile = /opt/module/flume/taildir_position.json
a1.sources.r1.interceptors =  i1
a1.sources.r1.interceptors.i1.type = com.atguigu.ETLInterceptor$MyBuilder

#描述channel
a1.channels.c1.type = org.apache.flume.channel.kafka.KafkaChannel
a1.channels.c1.kafka.bootstrap.servers = hadoop102:9092,hadoop103:9092,hadooop104:9092
a1.channels.c1.kafka.topic = topic_log
a1.channels.c1.parseAsFlumeEvent = false

#绑定source和channel以及sink和channel的关系
a1.sources.r1.channels = c1

​ taildir source:

taildir_position.json存储的文件格式:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值