首页 > 代码库 > Flume NetCat Demo

Flume NetCat Demo

准备工作:

  1.apache官网下载flume

  2.解压flume

  3.修改flume-env.sh,配置JAVA_HOME


NetCat采集Demo:

  1.在conf中创建netcat-logger.conf

# 定义这个agent中各组件的名字a1.sources = r1a1.sinks = k1a1.channels = c1# 描述和配置source组件:r1a1.sources.r1.type = netcata1.sources.r1.bind = localhosta1.sources.r1.port = 44444# 描述和配置sink组件:k1a1.sinks.k1.type = logger# 描述和配置channel组件,此处使用是内存缓存的方式a1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 100# 描述和配置source  channel   sink之间的连接关系a1.sources.r1.channels = c1a1.sinks.k1.channel = c1

 

  2.启动agent采集数据

bin/flume-ng agent -c conf -f conf/netcat-logger.conf -n a1  -Dflume.root.logger=INFO,console

  -c conf   指定flume自身的配置文件所在目录

  -f conf/netcat-logger.con  指定我们所描述的采集方案

  -n a1  指定我们这个agent的名字

 

  3.测试

  telnet localhost 44444

 

Flume NetCat Demo