Ø 应用场景(一):
采集发往某个端口的所有数据、、、
#example.comf:A single-node Flume configuration
#Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
#Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
#Describe the sink
a1.sinks.k1.type = logger
#Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactioinCapacity = 100
#Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
说明:
以上为flume-ng小案例的配置文件,具体如下:
l sources
l sinks
l channels
启动命令,
$ bin/flume-ng agent --conf conf --conf-file conf/netcat-logger.conf --name a1 -Dflume.root.logger=INFO,console
说明:
1、这种是直接启动在前台,主要是便于查看
2、在实际生产环境中建议以后台方式启动
然后,可以使用telnet进行数据测试
->telnet localhost 44444
Ø 应用场景(二):
监视文件夹、、、
配置文件详见spool-loggger.conf
启动命令:
bin/flume-ng agent -c ./conf -f
./conf/spool-logger.conf -n al -Dflume.root.logger=INFO,console
测试:
往/root/flumespool放文件
mv xx/xxxfile /root/flumespool,但是不要在里面生成文件
另外,
Flume安装问题:
1、下载、解压
2、ln
3、找到conf,根据应用场景写相应的配置文件,比如spool-logger.conf
4、使用bin/flume-ng agent -c ...启动即可
5、测试,[根据具体的应用场景使用不同的测试方式]