flume几个基本配置

使用的版本是:apache-flume-1.6.0

1、三个基本组件的选择与命名

agent.sources = source
agent.channels = memoryChannel
agent.sinks = sink

2、配置shell命令收集日志

agent.sources.source.channels = memoryChannel
agent.sources.source.type = exec
agent.sources.source.shell = /bin/bash -c
agent.sources.source.command = tail -F /wls/apache/applogs/tm_omm/access.log.`date -d today +"%Y-%m-%d"`
##执行date命令匹配日志文件 

3、解决中文乱码问题(待确认)

agent.sources.source.charset = GB2312
agent.sinks.sink.charset = GB2312

4、解决分区数据不均匀问题
flume向kafka吐数据时,可能会出现在一个时间段内各个分区的数据不均匀问题,严重时会出现某个分区无数据、某个分区超多数据。

agent.sources.sources.interceptors = i1
agent.sources.sources.interceptors.i1.type = org.apache.flume.sink.solr.morphline.UUIDInterceptor$Builder
agent.sources.sources.interceptors.i1.headerName = key
agent.sources.sources.interceptors.i1.preserveExisting = false

猜你喜欢

转载自blog.csdn.net/kong2030/article/details/80655831