注:windows的flume安装运行传送门:windows上安装运行flume
环境
Centos7+jdk7+flume1.7+telnet客户端
注:最新版flume1.8需要jdk1.8支持
安装
jdk的安装不多赘述,flume1.7的安装。
进入官网:http://flume.apache.org/
然后找到1.7版本下载放到centos系统解压即可
根据官方文档quickStart
解压文件中打开docs文件夹中的index.html即可本地查看文档
官方文档地址(PDF版):http://flume.apache.org/releases/content/1.7.0/FlumeUserGuide.pdf
进入Flume 1.7.0 User Guide 根据stepup进行操作:根据A simple example的步骤。这里就不一一翻译原文,直接上实际步骤
1.在apache-flume-1.7.0-bin\conf目录下创建一个example.conf配置文件
然后把官文档中的案例内容复制到example.conf文件中,如下内容:
# example.conf: A single-node Flume configuration
# 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
2.进入到解压flume目录中执行命令文档中的执行命令如下:
[root@mini3 apache-flume-1.7.0-bin]# bin/flume-ng agent --conf conf --conf-file conf/example.conf --name a1 -Dflume.root.logger=INFO,console
参数的简要说明:指明conf文件路径、指明conf文件、指定agent、指明log打印信息级别和位置
更加详细的参数说明可查看文档中的介绍
执行效果:</