flume案例一:监听端口数据到flume日志中
案例说明
数据源:netcat source
目的地:logger Sink
source:netcat,host,post
channel:基于内存的缓冲池 memory
sink:logger
配置文件
[root@node1 data]# vim portToLogger.conf
[root@node1 data]# pwd
/opt/data
[root@node1 data]# cat portToLogger.conf
# 给flume采集进程起一个别名 a1
# 定义flume进程中有几个source、sink、channel,以及每一个source的别名
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# 定义flume进程中source连接到数据源信息
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
a1.sinks.k1.type = logger
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
运行Flume采集程序
# 启动flume
flume-ng agent -n a1 -f portToLogger.conf -Dflume.root.logger=INFO,console
# 连接端口,编写数据 查看flume监听数据
yum install -y telnet
telnet localhost 44444
本文来自博客园,作者:jsqup,转载请注明原文链接:https://www.cnblogs.com/jsqup/p/16554433.html