天天看点

Flume 安装

tar -zxvf apache-flume-1.7.0-bin.tar.gz -C /usr/local/

1.配置环境变量

export FLUME_HOME=/usr/local/apache-flume-1.7.0-bin
export PATH=$PATH:$FLUME_HOME/bin
           

source /etc/profile

2.新建个Flume配置文件

进入到flume的conf下,创建一个

flume.conf

文件

# 指定Agent的组件名称
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# 指定Flume source(要监听的路径)
a1.sources.r1.type = spooldir
a1.sources.r1.spoolDir = /home/hadoop/log

# 指定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
           

3.启动flume agent

$ cd flume
$ bin/flume-ng agent --conf conf --conf-file conf/flume.conf --name a1 -Dflume.root.logger=INFO,console
           

4.控制台就可以显示收集的日志信息

控制台显示:

Flume 安装

继续阅读