首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > 云计算 >

flume ng 1.3 装配配置方法

2012-12-24 
flume ng 1.3 安装配置方法业务系统需要收集监控系统日志,想到了hadoop的flume。经过试验,虽说功能不算足够

flume ng 1.3 安装配置方法
业务系统需要收集监控系统日志,想到了hadoop的flume。经过试验,虽说功能不算足够强大,但基本上能够满足功能需求。Flume 是一个分布式、可靠和高可用的服务日志收集工具,能够和hadoop,hive等配置完成日志收集,存储,分析处理等工作,更详细的介绍可以参见apache网站。下面介绍下简单的安装配置方法

1,网上下载flume-ng安装包,分别部署在收集和接收日志文件的服务器上,服务器上需安装jdk 1.6以上,

http://flume.apache.org/download.html
tar -zxvf apache-flume-1.3.0-bin.tar.gz
2, 日志文件接收端端新建conf/flume-conf.properties server端的具体配置如下

从avro source端接收数据,然后写入到HDFS文件系统中

agent.sources = tailsource-1 tailsource-2agent.channels = memoryChannel-1 memoryChannel-2agent.sinks = remotesink remotesink-2agent.sources.tailsource-1.type = execagent.sources.tailsource-1.command = tail -F /tmp/linux2.logagent.sources.tailsource-1.channels = memoryChannel-1agent.sources.tailsource-2.type = execagent.sources.tailsource-2.command = tail -F /tmp/linux2_2.logagent.sources.tailsource-2.channels = memoryChannel-2agent.sources.tailsource-1.interceptors = host_int timestamp_int inter1agent.sources.tailsource-1.interceptors.host_int.type = hostagent.sources.tailsource-1.interceptors.host_int.hostHeader = hostnameagent.sources.tailsource-1.interceptors.timestamp_int.type = org.apache.flume.interceptor.TimestampInterceptor$Builder#agent.sources.tailsource-1.interceptors = inter1agent.sources.tailsource-1.interceptors.inter1.type = staticagent.sources.tailsource-1.interceptors.inter1.key = datacenteragent.sources.tailsource-1.interceptors.inter1.value = BEIJINGagent.sources.tailsource-2.interceptors = host_int timestamp_int inter1agent.sources.tailsource-2.interceptors.host_int.type = hostagent.sources.tailsource-2.interceptors.host_int.hostHeader = hostnameagent.sources.tailsource-2.interceptors.timestamp_int.type = org.apache.flume.interceptor.TimestampInterceptor$Builder#agent.sources.tailsource-1.interceptors = inter1agent.sources.tailsource-2.interceptors.inter1.type = staticagent.sources.tailsource-2.interceptors.inter1.key = datacenteragent.sources.tailsource-2.interceptors.inter1.value = linux2_2agent.channels.memoryChannel-1.type = memoryagent.channels.memoryChannel-1.keep-alive = 10agent.channels.memoryChannel-1.capacity = 100000agent.channels.memoryChannel-1.transactionCapacity =100000agent.channels.memoryChannel-2.type = memoryagent.channels.memoryChannel-2.keep-alive = 10agent.channels.memoryChannel-2.capacity = 100000agent.channels.memoryChannel-2.transactionCapacity =100000agent.sinks.remotesink.type = avroagent.sinks.remotesink.hostname = 172.16.251.1agent.sinks.remotesink.port = 44444agent.sinks.remotesink.channel = memoryChannel-1agent.sinks.remotesink-2.type = avroagent.sinks.remotesink-2.hostname = 172.16.251.1agent.sinks.remotesink-2.port = 44444agent.sinks.remotesink-2.channel = memoryChannel-2

4,后台运行
nohup bin/flume-ng agent -n agent -c conf -f conf/flume-conf.properties >1.log &

查看日志vi flume.log
端口连接情况 netstat -an|grep 44444
[flume@dtydb6 flume-1.4]$ netstat -an|grep 44444
tcp        0      0 ::ffff:172.16.251.1:44444   :::*                        LISTEN  


5,测试方法

可以使用如下类似的脚本,定期向日志文件写入来进行测试

for i in {1..1000000}; do echo "LINUX2  PRESS ************* Flume log rotation $i" >> /tmp/linux3.log; sleep 0.0001; done



参考资料:
http://flume.apache.org/FlumeUserGuide.html






热点排行