1. 概述
source -> channel -> sink
(nc) -> channel -> (logger)
2. 案例实操
2.1 配置文件
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 = localhost 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
<a name="aYf6u"></a>
## 2.2 管理命令
<a name="qGOtI"></a>
### 1. 启动服务端
```shell
flume-1.9.0 > bin/flume-ng agent -n a1 -c conf/ -f job/net-flume-logger.conf -Dflume.root.logger=INFO,console
2. 测试
- 另启一个窗口(客户端),并使用
nc localhost 44444
来创建客户端链接 客户端输入内容:
flume > nc localhost 44444
hello world
OK
服务端收到内容并打印出: