客户端配置文件
a1.channels = ch1
a1.sources = exec-source1
a1.sinks = hdfs-sink1
a1.channels.ch1.type = memory
a1.channels.ch1.capacity = 1000
a1.channels.ch1.transactionCapacity = 1000
a1.channels.ch1.keep-alive = 30
a1.sources.exec-source1.type = exec
a1.sources.exec-source1.shell = /bin/bash -c
a1.sources.exec-source1.command = tail -n +0 -F 后跟要监控的日志文件路径
a1.sources.exec-source1.channels = ch1
a1.sources.exec-source1.threads = 5
a1.sources.exec-source1.restartThrottle = 100000
a1.sources.exec-source1.restart = true
a1.sources.exec-source1.logStdErr = true
a1.sinks.hdfs-sink1.channel = ch1
a1.sinks.hdfs-sink1.type = avro
a1.sinks.hdfs-sink1.hostname = 192.168.1.2
a1.sinks.hdfs-sink1.port = 3014
启动方式(客户端与服务端相同)
# bin/flume-ng agent -c conf/ -f conf/test.conf(配置文件名称) -n a1 -Dflume.root.logger=INFO,console
服务端配置文件内容
a1.channels = ch1 ch2
a1.sources = r1
a1.sinks = s1 s2
a1.channels.ch1.type = memory
a1.channels.ch1.capacity = 10000
a1.channels.ch1.transactionCapacity = 10000
a1.channels.ch1.keep-alive = 60
a1.channels.ch2.type = memory
a1.channels.ch2.capacity = 10000
a1.channels.ch2.transactionCapacity = 10000
a1.channels.ch2.keep-alive = 60
a1.sources.r1.type = avro
a1.sources.r1.bind = 192.168.1.2
a1.sources.r1.port = 3014
a1.sources.r1.channels = ch1 ch2
a1.sources.r1.threads = 5
a1.sources.r1.selector.type = replicating
a1.sinks.s1.channel = ch1
a1.sinks.s1.type = avro
a1.sinks.s1.hostname = 192.168.1.3
a1.sinks.s1.port = 3014
a1.sinks.s2.channel = ch2
a1.sinks.s2.type = avro
a1.sinks.s2.hostname = 192.168.1.3
a1.sinks.s2.port = 3114