下载flume:html
wget
解压了就能够使用了:shell
配置文件:apache
agent1.channels = ch1 agent1.sources = avro-source1 agent1.sinks = log-sink1 agent1.channels.ch1.type = memory # Define an Avro source called avro-source1 on agent1 and tell it # to bind to 0.0.0.0:41414. Connect it to channel ch1. agent1.sources.avro-source1.channels = ch1 agent1.sources.avro-source1.type = avro agent1.sources.avro-source1.bind = 0.0.0.0 agent1.sources.avro-source1.port = 41414 # and connect it to the other end of the same channel. agent1.sinks.log-sink1.type = file_roll agent1.sinks.log-sink1.channel = ch1 agent1.sinks.log-sink1.sink.directory = /app/flume/logs
配置文件的知识能够参考如下网页:tomcat
http://flume.apache.org/FlumeUserGuide.html#file-channel 服务器
而后服务器端就能够启动了:app
nohup ./bin/flume-ng agent -n agent1 -c conf -f conf/flume.conf > 1.log &
这样,就启动了一个服务器,在41414端口;ide
------------------客户端------------------工具
安装方式同样:
ui
配置文件:日志
agent.sources = tailsource-tomcat agent.channels = memoryChannel-1 agent.sinks = remotesink agent.sources.tailsource-tomcat.type = exec agent.sources.tailsource-tomcat.command = tail -F /app/yldsys/tomcat/logs/catalina.out agent.sources.tailsource-tomcat.channels = memoryChannel-1 agent.channels.memoryChannel-1.type = memory agent.channels.memoryChannel-1.keep-alive = 10 agent.channels.memoryChannel-1.capacity = 100000 agent.channels.memoryChannel-1.transactionCapacity =100000 agent.sinks.remotesink.type = avro agent.sinks.remotesink.hostname = 127.0.0.1 agent.sinks.remotesink.port = 41414 agent.sinks.remotesink.channel = memoryChannel-1
经过一个exec工具,将日志tail出来,而后发送到avro对应到收集器中。