Flume小案例札记

Ø 应用场景(一):

采集发往某个端口的所有数据、、、

 

#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、测试,[根据具体的应用场景使用不同的测试方式]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值