案例一:Flume 监听端口,在控制台输出端口数据
创建配置文件
1.在 flume 的 conf 同级目录下创建 job 文件夹,并在 job 文件夹内创建 flume-telnet-logger.conf
cd /usr/wang/flume
mkdir job
cd job
vim flume-telnet-logger.conf
将下方文件拷贝到 flume-telnet-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 = 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
安装测试工具
1.在这个案例中,需要使用到 telnet,首先安装 telnet 工具
sudo