flume的安裝使用
來自: http://my.oschina.net/u/1462124/blog/609979
下載flume:
wget
解壓了就可以使用了:
配置文件:
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
配置文件的知識可以參考以下網頁:
http://flume.apache.org/FlumeUserGuide.html#file-channel
然后服務器端就可以啟動了:
nohup ./bin/flume-ng agent -n agent1 -c conf -f conf/flume.conf > 1.log &
這樣,就啟動了一個服務器,在41414端口;
------------------客戶端------------------
安裝方式一樣:
配置文件:
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對應到收集器中。
本文由用戶 baihu 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!