flume的安装使用
baihu
9年前
来自: 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对应到收集器中。