欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

windows上安装运行flume

程序员文章站 2022-06-15 10:17:46
...

环境

win7+jdk7+flume1.7

注:最新版flume1.8需要jdk1.8支持


安装

jdk的安装不多赘述,flume1.7的安装。

进入官网:http://flume.apache.org/

然后找到1.7版本下载解压即可


根据官方文档quickStart

解压文件中打开docs文件夹中的index.html即可本地查看文档

进入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.进入到bin目录中打开cmd执行命令

不能直接复制粘贴官网的命令,那是对于linux的。

进入bin目录中,不建议直接双击flume-ng.cmd,因为这里有报错程序会直接退出,不能够看到错误信息。

执行方式,先打开cmd命令行,然后执行命令:

flume-ng.cmd agent -conf ../conf --conf-file ../example.conf -name a1 -Dflume.root.logger=INFO,console
报错:

windows上安装运行flume

原因是参数有误。windows与linux一些命令格式有不同

更换执行命令:

 flume-ng.cmd  agent -conf ../conf  -conf-file ../conf/example.conf  -name a1  -property flume.root.logger=INFO,console

参数的简要说明:指明conf文件路径、指明conf文件、指定agent、指明log打印信息级别和位置

参数详细使用可以打开bin目录下的:flume-ng.ps1 进行查看,有详细说明(是一个可执行程序,可以调试)

执行效果:

windows上安装运行flume

说明启动成功。

3.通过telnet客户端进行测试

打开另一个cmd执行:

telnet localhost 44444
windows上安装运行flume

如图输入状态的telnet客户端,输入信息后,flume即监听到并打印日志


注:windows的telnet客户端不能使用解决方式:

控制面板--->程序和功能----->打开或关闭windows功能---->勾选Telnet客户端并确认即可使用