1. 安装需求:
1)jdk 1.8 及以后
2)Memory 要够source、channel、sink使用
3)Disk Space 要求有一定的磁盘空间
4)Directory Permissions 要求agent对文件夹有读写权限
每一个agent只采集本机的数据
2.安装节点:
哪个节点需要就安装哪一个节点上
3. 安装步骤
1)上传安装包
2)解压
3)配置环境变量(一般不配置,一般启动的时候,都到安装目录的bin目录下启动)
4)修改flume的配置文件
/home/hadoop/apps/apache-flume-1.8.0-bin/conf
mv flume-env.sh.template flume-env.sh
vi flume-env.sh
export JAVA_HOME=/home/hadoop/apps/jdk1.8.0_73
到这里就已经算是安装完成了
模拟数据发送
向localhost:44455端口中发送数据
telnet:模拟向指定主机、指定的端口 发送数据的
1)配置的就是agent 配置文件
# 给当前的agent source channel sink起别名 a1代表当前agent的名字
# source的别名
a1.sources = r1
# channel的别名
a1.channels = c1
# sink的别名
a1.sinks = k1
# 配置source的相关信息 数据源的 netcat一个主机的一个端口的数据 指定主机 端口
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44455
# 配置channel的相关信息 内存
a1.channels.c1.type = memory
# 配置sink的信息 控制台打印
a1.sinks.k1.type = logger
# 绑定source channel sink的对应关系
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
2)启动flume
./flume-ng agent --conf conf --conf-file /home/hadoop/apps/apache-flume-1.8.0-bin/conf/flume_conf/test.conf --name a1 -Dflume.root.logger=INFO,console
--conf-file 指定配置文件的路径
--name 指定agent的别名,要和配置文件保持一致
-Dflume.root.logger 指定控制台打印输出
3)安装telnet服务
sudo yum install -y telnet
4)模拟数据发送
telnet 主机名 端口
telnet localhost 44455
成功截图: