本实验使用的Flume版本为1.9.0。
1、解压安装Flume
tar -zxf /opt/hadoop/apache-flume-1.9.0-bin.tar.gz -C ~/
2、配置Flume,实现从特定端口采集数据
在flume的安装目录下找到conf目录,创建flume-conf.properties文件,然后修改该配置文件的内容
agent.sources = src
agent.channels = memoryChannel
agent.sinks = loggerSink
# For each one of the sources, the type is defined
agent.sources.src.type = netcat
# 表示从本地获取数据
agent.sources.src.bind=localhost
# 绑定端口号
agent.sources.src.port=8090
# The channel can be defined as follows.
agent.sources.src.channels = memoryChannel
# Each sink's type must be defined
agent.sinks.loggerSink.type = logger
#Specify the channel the sink should use
agent.sinks.loggerSink.channel = memoryChannel
# Each channel's type is defined.
agent.channels.memoryChannel.type = memory
保存文件。
flume-conf.properties配置使用netcat在8090端口收集数据。