美文网首页
flume-1.9.0安装部署测试

flume-1.9.0安装部署测试

作者: FyK_21f8 | 来源:发表于2021-05-18 17:58 被阅读0次

解压安装包

# 解压安装包
tar -zxvf apache-flume-1.9.0-bin.tar.gz

# 改个小名字
mv mv apache-flume-1.9.0-bin flume-1.9.0

系统环境变量

# 写入环境变量
vim /etc/profile

# 写入以下信息
# export FLUME_HOME=/apps/big-data/flume-1.9.0
# export PATH=$FLUME_HOME/bin:$PATH

# 刷新环境变量
source /etc/profile

flume环境变量

# flume conf目录下操作
cd /apps/big-data/flume-1.9.0/conf
cp flume-env.sh.template flume-env.sh

# 修改环境配置脚本
vim flume-env.sh

# 写入以下信息
export JAVA_HOME=/usr/java/jdk1.8.0_112

创建测试文件

# 在flume根目录下操作
cd /apps/big-data/flume-1.9.0

# 创建测试文件
touch flume-test.conf

# 写入配置
tee -a flume-test.conf<<EOF
# 给source,channel,sink取名
a1.sources = r1
a1.channels = c1
al.sinks = k1

# 定义具体的source内容
a1.sources.r1.type = netcat
al.sources.r1.bind = 192.168.60.135
al.sources.r1.port = 28765

# 定义具体的channel内容
a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 100

# 定义具体的sink内容
al.sinks.k1.type = logger

# 组装source,channel,sink
a1.sources.r1.channels = c1
al.sinks.k1.channel = c1
EOF

启动flume

flume-ng agent -c conf -f /apps/big-data/flume-1.9.0/flume-test.conf -n a1 -Dflume.root.logger=INFO,console

远程机器上使用telnet测试

[root@localhost ~]# telnet 192.168.60.135 28765
Trying 192.168.60.135...
Connected to 192.168.60.135.
Escape character is '^]'.
hello flume
OK

flume部署机器上收到的消息

2021-05-18 16:09:07,071 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:95)] Event: { headers:{} body: 68 65 6C 6C 6F 20 66 6C 75 6D 65 0D                 hello flume. }

相关文章

网友评论

      本文标题:flume-1.9.0安装部署测试

      本文链接:https://www.haomeiwen.com/subject/jicyjltx.html