- 解压
- 重命名为:flume-netcat
- 配置环境变量
vi /etc/profile export FLUME_HOME_NETCAT=/usr/local/src/flume-netcat export PATH=$PATH:$FLUME_HOME_NETCAT/bin #刷新环境变量 source /etc/profile
- 修改flume-env.sh配置文件
#路径以自己的环境为准 export JAVA_HOME=/usr/local/src/jdk
- 配置agent配置文件
vi example
# example.conf: A single-node Flume configuration # 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 = master 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
- 启动flume
flume-ng agent --conf $FLUME_HOME_NETCAT/conf --conf-file $FLUME_HOME_NETCAT/conf/example --name a1 -Dflume.root.logger=INFO,console
7. 使用telnet进行测试
telnet master 44444
从上面圈出的flume.sink.LoggerSink.process我们可以知道 这是控制台的sink来处理。
Event: { headers:{} body: 77 73 71 77 73 71 77 73 71 0D
wsqwsqws
Event是flume数据传输的基本单元
Event = 可选的header + byte array



