Flume实战监听网络端口

具体的配置解释见官网

http://flume.apache.org/FlumeUserGuide.html#flume-sources


1、flume安装目录下新建文件夹 example 

2、在example下新建文件 

netcat-logger.conf
内容如下:
#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 = nbdo3
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.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

3、启动命令
flume-ng agent -c ../conf - fnetcat-logger.conf -n a1 -Dflume.root.logger=INFO,console
解释:
-c ../conf 指定flume自身的配置文件所在目录
-f conf/netcat-logger.conf   指定我们所描述的采集方案
-n a1   指定我们这个agent的名字


4、clone session 启动telnet
如果telnet命令无效,安装telnet。见博文:http://www.cnblogs.com/yangxia-test/p/4159891.html


5、测试
telnet 输入
hello
world

flume监听到的画面


-------------

更多的Java,Angular,Android,大数据,J2EE,Python,数据库,Linux,Java架构师,:

http://www.cnblogs.com/zengmiaogen/p/7083694.html


你可能感兴趣的:(大数据)