(02)Flume安装及其启动
1、将文件解压到/usr/local
[ src]# tar -zxvf apache-flume-1.6.0-bin.tar.gz -C /usr/local/
2、创建flume-env.sh文件,并设置jdk路径
[ 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 [ 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
[ apache-flume-1.6.0-bin]# mkdir /usr/local/apache-flume-1.6.0-bin/myagent
[ apache-flume-1.6.0-bin]# vim /usr/local/apache-flume-1.6.0-bin/myagent/a3.conf
内容如下:
#bin/flume-ng agent -n a3 -f myagent/a3.conf -c conf -Dflume.root.logger=INFO,console #定义agent名, source、channel、sink的名称 a3.sources = r1 a3.channels = c1 a3.sinks = k1 #具体定义source a3.sources.r1.type = spooldir a3.sources.r1.spoolDir = /usr/local/logs/flumelogs #具体定义channel a3.channels.c1.type = memory a3.channels.c1.capacity = 1000 a3.channels.c1.transactionCapacity = 100 #具体定义sink a3.sinks.k1.type = logger #组装source、channel、sink a3.sources.r1.channels = c1 a3.sinks.k1.channel = c1
指定source为spooldir,监控的目录是:/usr/local/logs/flumelogs,如果该目录下的文件发生变化,就会通过flume把新变化的文件信息采集过来缓存在memory,通过sink指定的logger打印在console(控制台)
4、启动flume
[ 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下,查看控制台已经打印出信息,如图所示:
相关推荐
chenguangchun 2020-07-26
myt0 2020-07-18
IT影风 2020-07-18
chenguangchun 2020-06-28
jiaomrswang 2020-06-26
myt0 2020-06-16
xiaoxiaojavacsdn 2020-06-08
zzjmay 2020-06-07
strongyoung 2020-06-04
ErixHao 2020-05-20
啦啦啦啦啦 2020-05-15
wanfuchun 2020-05-14
onwaygoahead 2020-05-05
xiaoxiaojavacsdn 2020-05-01
chenguangchun 2020-04-18
QAnyang 2020-03-14
wsong 2020-03-13