Flume学习笔记
程序员文章站
2022-03-14 14:10:38
...
一、安装
Welcome to Apache Flume
Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log data. It has a simple and flexible architecture based on streaming data flows. It is robust and fault tolerant with tunable reliability mechanisms and many failover and recovery mechanisms. It uses a simple extensible data model that allows for online analytic application.
2、下载地址:http://archive.apache.org/dist/flume/ (本人下载的是1.7的版本作为学习)
3、上传安装包解压
# 解压
tar -xzvf apache-flume-1.7.0-bin.tar.gz
# 重命名
mv apache-flume-1.7.0-bin flume-1.7.0
# 配置
cd flume-1.7.0/conf
cp flume-env.sh.template flume-env.sh
cp flume-conf.properties.template flume-conf.properties
vi flume-env.sh
export JAVA_HOME=/opt/appdir/java/jdk1.8.0
export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote"
export JAVA_OPTS="$JAVA_OPTS -Dorg.apache.flume.log.rawdata=true -Dorg.apache.flume.log.printconfig=true "
4、测试示例:
4.1、示例配置
cd flume-1.7.0
mkdir ./operation
cd operation
vi operation.conf
# 内容如下:
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
# Describe the sink
a1.sinks.k1.type = logger
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
##################################################
# 保存退出
4.2、启动运行
[aaa@qq.com flume-1.7.0]$ cd flume-1.7.0
[aaa@qq.com flume-1.7.0]$ ./bin/flume-ng agent -n a1 -f ./operation/operation -Dflume.root.logger=INFO,console
成功信息:
4.3、通过telnet向此服务发送信息测试:
4.4 观察结果: