flume linux 命令,flume 配置使用

flume配置获取信息传输到kafka集群

conf目录下新建配置文件

[root@localhost flume]# vim conf/file-monitor.conf

# 声明agent

a1.sources = r1

a1.sinks = k1

a1.channels = c1

# 定义数据源

a1.sources.r1.type = exec

a1.sources.r1.command = tail -F /data/xx.log

a1.sources.r1.channels = c1

# filter过滤器

a1.sources.r1.interceptors=i1

a1.sources.r1.interceptors.i1.type=regex_filter

#a1.sources.r1.interceptors.i1.regex=(Parsing events)(.*)(END)

a1.sources.r1.interceptors.i1.regex=(aaaa)(.*)    #只有匹配到才传输到channels

#定义event暂存位置,可以使内存,磁盘,数据库等

a1.channels.c1.type = file

a1.channels.c1.checkpointDir = /data/flume/chk

a1.channels.c1.dataDirs = /data/flume/data

# 定义数据流向kafka

#a1.sinks.k1.type = logger

a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink

a1.sinks.k1.brokerList = 192.168.41.47:9092,192.168.41.127:9092,192.168.41.86:9092

a1.sinks.k1.topic = mytopic

#a1.sinks.k1.requiredAcks = 1

#a1.sinks.k1.batchSize = 20

a1.sinks.k1.serializer.class=kafka.serializer.StringEncoder

a1.sinks.k1.channel = c1

启动

[root@localhost flume]# nohup bin/flume-ng agent -n a1 -c conf/ -f conf/file-monitor.conf  -Dflume.root.logger=INFO,console > nohup.out 2>&1 &

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值