您的位置:首页 > 其它

分布式flume日志收集系统

2018-01-02 17:27 369 查看
1.架构图,摘自flume官网



2.这里我们用两个agent收集,然后输入到一个agent去,落到HDSF上

3.参考配置文件

source 采用exec方式代替,在两台机器上部署
a1.sources=s1
a1.channels=c1
a1.sinks=s1

#source
a1.sources.s1.type=exec
a1.sources.s1.command=tail -f /home/hadoop/data.log

#sink

a1.sinks.s1.type=avro
a1.sinks.s1.hostname=centos-1
a1.sinks.s1.port=44444

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

a1.sources.s1.channels=c1
a1.sinks.s1.channel=c1

第二类agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = avro
a1.sources.r1.bind = centos-1
a1.sources.r1.port = 44444
a1.sources.r1.interceptors = i1
a1.sources.r1.interceptors.i1.type = timestamp  拦截器给event增加时间

# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://centos-1:8020/flume/events/%Y/%m/%d/
a1.sinks.k1.hdfs.filePrefix = events-
a1.sinks.k1.hdfs.rollSize=1024
a1.sinks.k1.hdfs.rollInterval=0
a1.sinks.k1.hdfs.rollCount=0

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1


3.HDFS sink参数解释

http://lxw1234.com/archives/2015/10/527.htm
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息