Bootstrap

Flume(端口)

Flume配置(监听端口)

1.上传解压并改名

tar -zxvf apache-flume-1.9.0-bin.tar.gz
mv  apache-flume-1.9.0-bin flume

2.修改环境变量

vi /etc/profile
export FLUME_HOME=/opt/module/flume
export PATH=$PATH:$FLUME_HOME/bin
source /etc/profile

3.修改配置文件

cd /opt/module/flume/conf
vi netcat-logger.conf
a1.sources = r1
a1.sinks = k1
a1.channels = c1
#描述并配置sources组件(数据源类型、采集数据源的应用地址)  
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = 44444
#描述并配置sinks组件(采集后的数据流出的类型)  
a1.sinks.k1.type = logger
#描述并配置channels(缓存类型、内存缓存大小和事务缓存大小)
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
#将source和sink通过同一个channel连接绑定  
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

4.启动flume

flume-ng agent --conf conf/ --conf-file /opt/module/flume/conf/netcat-logger.conf --name a1 -Dflume.root.logger=INFO,console

5.采集数据测试

需要额外打开一个终端窗口进行测试

yum -y install telnet
telnet <ip地址> 44444
;