admin管理员组文章数量:1642494
一、安装环境和软件
1、flume 运行需要java环境,所以运行flume之前必须安装并配置java环境(如果安装了jdk,但是没有配置jdk环境,运行 flume 时会抛出找不见 java.exe 的错误)。
2、flume 1.8 需要 java运行时环境java 1.8或更高。
3、下载 flume 1.8 ,下载地址;因为下载flume 是 tar.gz,直接解压就可以了。
二、运行
1、在flume的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
# Flume提供了各种source的实现,包括Avro Source、 Exce Source、 Spooling Directory Source、 NetCat Source、 Syslog Source、 Syslog TCP Source、Syslog UDP Source、 HTTP Source、 HDFS Source, etc
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
# Describe the sink
# 包括HDFS sink、 Logger sink、 Avro sink、 File Roll sink、 Null sink、 HBasesink, etc
a1.sinks.k1.type = logger
# Use a channel which buffers events in memory
# Flume对于Channel,则提供了Memory Channel、 JDBC Chanel、 File Channel,etc
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、在cmd 路径切换到 flume的bin路径下,运行:
flume-ng.cmd agent -conf ../conf -conf-file ../conf/example.conf -name a1 -property flume.root.logger=INFO,console
运行结果如下图,可以看到监听的是本地的端口44444;
3、我们再启动一个cmd窗口,输入 :telnet 127.0.0.1 44444,然后进入一个可编辑输入的窗口,我们在窗口输入“nihao”,然后在 flume 启动的窗口可以看见打印的信息。(如果提示 telnet 不是内部或外部命令,也不是可运行的程序,可能是windows没有打开telnet客户端,打开telnet客户端就可以了)。
三、说明
以上只是一个agent的简单demo,一个agent的结构图:
版权声明:本文标题:flume 1.8 在 windows下安装运行 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1725569175a1030274.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论