Big Data Cluster Construction-"Flume"-Cainiao Xiaohui
- create:
mkdir -p /opt/flume
- enter:
cd /opt/flume
- Upload
- Unzip:
tar -zxvf apache-flume-1.8.0-bin.tar.gz
- Modify the configuration file flume-env.sh
cd /opt/flume/apache-flume-1.8.0-bin/conf/
mv flume-env.sh.template flume-env.sh
vi flume-env.sh
//修改jdk位置
export JAVA_HOME=/opt/java/jdk1.8.0_141
- Write configuration file
vi flume.conf
# 指定Agent的组件名称
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# 指定Flume source(要监听的路径)
# spooldir 目录监控,该文件夹产生文件时打印
# exec 文件监控,文件内容修改时打印
a1.sources.r1.type = spooldir
#先创建这个目录
a1.sources.r1.spoolDir = /logs
# 指定Flume sink
a1.sinks.k1.type = logger
# 指定Flume channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# 绑定source和sink到channel上
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
- run
cd /opt/flume/apache-flume-1.8.0-bin/
bin/flume-ng agent --conf conf --conf-file conf/flume.conf --name a1 -Dflume.root.logger=INFO,console