下載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對應到收集器中。