下载flume:
wget
解压了就可以使用了:
配置文件:
agent1.channels = ch1agent1.sources = avro-source1agent1.sinks = log-sink1agent1.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 = ch1agent1.sources.avro-source1.type = avroagent1.sources.avro-source1.bind = 0.0.0.0agent1.sources.avro-source1.port = 41414# and connect it to the other end of the same channel.agent1.sinks.log-sink1.type = file_rollagent1.sinks.log-sink1.channel = ch1agent1.sinks.log-sink1.sink.directory = /app/flume/logs
配置文件的知识可以参考以下网页:
然后服务器端就可以启动了:
nohup ./bin/flume-ng agent -n agent1 -c conf -f conf/flume.conf > 1.log &
这样,就启动了一个服务器,在41414端口;
------------------客户端------------------
安装方式一样:
配置文件:
agent.sources = tailsource-tomcatagent.channels = memoryChannel-1agent.sinks = remotesinkagent.sources.tailsource-tomcat.type = execagent.sources.tailsource-tomcat.command = tail -F /app/yldsys/tomcat/logs/catalina.outagent.sources.tailsource-tomcat.channels = memoryChannel-1agent.channels.memoryChannel-1.type = memoryagent.channels.memoryChannel-1.keep-alive = 10agent.channels.memoryChannel-1.capacity = 100000agent.channels.memoryChannel-1.transactionCapacity =100000agent.sinks.remotesink.type = avroagent.sinks.remotesink.hostname = 127.0.0.1agent.sinks.remotesink.port = 41414agent.sinks.remotesink.channel = memoryChannel-1
通过一个exec工具,将日志tail出来,然后发送到avro对应到收集器中。