giftRecord 没法采集到的原因

giftRecord 没法采集到的原因

https://img1.sycdn.imooc.com//climg/64c77df609c0bbab08600075.jpg

# Naming the components on the current agent. 
a1.sources = r1
a1.sinks = k1
a1.channels = c1


# Describing/Configuring the source.
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /home/flume/data/interceptor/moreType.txt

# Describing the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://192.168.12.204:8020/moreType/%y%m%d/%{logType}
a1.sinks.k1.hdfs.filePrefix = data-
a1.sinks.k1.hdfs.fileSuffix = .log
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.rollInterval = 3600
a1.sinks.k1.hdfs.rollSize = 134217728
a1.sinks.k1.hdfs.rollCount = 0
a1.sinks.k1.hdfs.writeFormat = Text
a1.sinks.k1.hdfs.useLocalTimeStamp = true

# Describing the channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Configuring the interceptor
a1.sources.r1.interceptors = i1 i2 i3 i4
a1.sources.r1.interceptors.i1.type = search_replace
a1.sources.r1.interceptors.i1.searchPattern = "type":"video_info"
a1.sources.r1.interceptors.i1.replaceString = "type":"videoInfo"
a1.sources.r1.interceptors.i2.type = search_replace
a1.sources.r1.interceptors.i2.searchPattern = "type":"user_info"
a1.sources.r1.interceptors.i2.replaceString = "type":"userInfo"
a1.sources.r1.interceptors.i3.type = search_replace
a1.sources.r1.interceptors.i3.searchPattern = "type":"gift_record"
a1.sources.r1.interceptors.i3.replaceString = "type":"giftRecord"
a1.sources.r1.interceptors.i4.type = regex_extractor
a1.sources.r1.interceptors.i4.regex = "type":"(\\w+)"
a1.sources.r1.interceptors.i4.serializers = s1
a1.sources.r1.interceptors.i4.serializers.s1.name = logType

# Binding the source, sink and channel.
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

https://img1.sycdn.imooc.com//climg/64c77e72090033d516650138.jpg



老师您好,不知道为什么flume拦截器这,在HDFS中总是会缺少gift_record的数据


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
徐老师 2023-07-31 17:43:08

这种问题建议这样排查

1.使用课程中提供的flume配置文件内容,直接复制,自己手写的容易出错,可以到电子书中复制

2.使用课程中的测试数据,建议直接复制,自己写的也有可能字母大小写不匹配

按照这个流程测试一下再看看

  • 提问者 慕慕9521829 #1

    老师,发现是channel type为memory的时候会有这个问题,换成file就不会了,想问下是什么情况会造成这样的结果

    2023-08-01 10:45:56
  • 徐老师 回复 提问者 慕慕9521829 #2
    和这个没关系,大概率还是数据问题导致的。你可以把file channel中配置的两个目录删一下,恢复一下环境,重新测试一下试试
    2023-08-01 10:50:51
  • 提问者 慕慕9521829 回复 徐老师 #3

    https://img1.sycdn.imooc.com//climg/64c87c1009b05e3d16630108.jpg

    https://img1.sycdn.imooc.com//climg/64c87c2009222a7316880110.jpg会跟这个换行符有关系吗,换行之后就正常了

    2023-08-01 11:30:59
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师