标签:cti Flume安装 ogg mkdir 内容 channels info color pool
1、将文件解压到/usr/local
[root@localhost src]# tar -zxvf apache-flume-1.6.0-bin.tar.gz -C /usr/local/
2、创建flume-env.sh文件,并设置jdk路径
[root@localhost local]# cp /usr/local/apache-flume-1.6.0-bin/conf/flume-env.sh.template /usr/local/apache-flume-1.6.0-bin/conf/flume-env.sh
[root@localhost local]# vim /usr/local/apache-flume-1.6.0-bin/conf/flume-env.sh
增加以下配置:
export JAVA_HOME=/usr/local/java/jdk1.8.0_201
如下图所示:
3、创建配置文件a3.conf
[root@localhost apache-flume-1.6.0-bin]# mkdir /usr/local/apache-flume-1.6.0-bin/myagent
[root@localhost apache-flume-1.6.0-bin]# vim /usr/local/apache-flume-1.6.0-bin/myagent/a3.conf
内容如下:
1 #bin/flume-ng agent -n a3 -f myagent/a3.conf -c conf -Dflume.root.logger=INFO,console 2 3 #定义agent名, source、channel、sink的名称 4 a3.sources = r1 5 a3.channels = c1 6 a3.sinks = k1 7 8 #具体定义source 9 a3.sources.r1.type = spooldir 10 a3.sources.r1.spoolDir = /usr/local/logs/flumelogs 11 12 #具体定义channel 13 a3.channels.c1.type = memory 14 a3.channels.c1.capacity = 1000 15 a3.channels.c1.transactionCapacity = 100 16 17 #具体定义sink 18 a3.sinks.k1.type = logger 19 20 #组装source、channel、sink 21 a3.sources.r1.channels = c1 22 a3.sinks.k1.channel = c1
指定source为spooldir,监控的目录是:/usr/local/logs/flumelogs,如果该目录下的文件发生变化,就会通过flume把新变化的文件信息采集过来缓存在memory,通过sink指定的logger打印在console(控制台)
4、启动flume
[root@localhost apache-flume-1.6.0-bin]# bin/flume-ng agent -n a3 -f myagent/a3.conf -c conf -Dflume.root.logger=INFO,console
启动成功如下图所示:
5、测试
新建一个文件,如下图所示:
移动到 /usr/local/logs/flumelogs下,查看控制台已经打印出信息,如图所示:
标签:cti Flume安装 ogg mkdir 内容 channels info color pool
原文地址:https://www.cnblogs.com/javasl/p/12303275.html