Hadoop生态Flume(二)安装配置

 

一、flume下载地址

列中的链接应显示可用镜像的列表,并根据您的推断位置进行默认选择。如果看不到该页面,请尝试使用其他浏览器。校验和和签名是主分发服务器上原始文件的链接。

Apache Flume二进制文件(tar.gz) apache-flume-1.9.0-bin.tar.gz apache-flume-1.9.0-bin.tar.gz.sha512 apache-flume-1.9.0-bin.tar.gz.asc
Apache Flume来源(tar.gz) apache-flume-1.9.0-src.tar.gz apache-flume-1.9.0-src.tar.gz.sha512 apache-flume-1.9.0-src.tar.gz.asc

必须使用PGP或MD5签名来验证下载文件的完整性。

flume1.9.0下载地址

二、安装环境

  1. Java运行时环境-Java 1.8或更高版本
  2. 内存-足够的内存,用于源,通道或接收器使用的配置
  3. 磁盘空间-足够的磁盘空间用于通道或接收器使用的配置
  4. 目录权限-代理使用的目录的读/写权限

三、配置

(1)解压安装

cp apache-flume-1.9.0-bin.tar.gz /home/mk
tar -zxvf apache-flume-1.9.0-bin.tar.gz
cd apache-flume-1.9.0-bin

(2)配置

cp conf/flume-conf.properties.template conf/flume.conf

flume.conf 

# Define a memory channel called ch1 on agent1
agent1.channels.ch1.type = memory
 
# Define an Avro source called netcat-source1 on agent1 and tell it
# to bind to 0.0.0.0:12200. Connect it to channel ch1.
agent1.sources.netcat-source1.channels = ch1
agent1.sources.netcat-source1.type = netcat
agent1.sources.netcat-source1.bind = 0.0.0.0
agent1.sources.netcat-source1.port = 12200
 
# Define a logger sink that simply logs all events it receives
# and connect it to the other end of the same channel.
agent1.sinks.log-sink1.channel = ch1
agent1.sinks.log-sink1.type = logger
 
# Finally, now that we've defined all of our components, tell
# agent1 which ones we want to activate.
agent1.channels = ch1
agent1.sources = netcat-source1
agent1.sinks = log-sink1

(3)(可选)基于模板创建flume-env.sh文件(或从头开始创建一个文件)。flume-ng可执行文件在--conf / -c命令行选项指定的conf目录中查找并获取名为“ flume-env.sh”的文件。使用flume-env.sh的一个用例是在开发自己的自定义Flume NG组件(例如源和接收器)时通过JAVA_OPTS指定调试或概要分析选项。

$ cp conf/flume-env.sh.template conf/flume-env.sh

(4)运行Flume NG

flume-ng可执行文件使您可以运行Flume NG代理或Avro客户端,这对于测试和实验非常有用。无论如何,您都需要指定一个命令(例如agent)和一个conf目录(--conf <conf dir>)。所有其他选项都是特定于命令的。

要使用上面的flume.conf启动flume服务器:

bin/flume-ng agent --conf ./conf/ -f conf/flume.conf -Dflume.root.logger=DEBUG,console -n agent1 -Dflume.monitoring.type=http -Dflume.monitoring.port=23310

请注意,agent名称由指定,-n agent1并且必须与配置中指定的agent名称匹配-f conf/flume.conf

测试:

$ telnet localhost 12200
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Hello world! <ENTER>
OK

输出日志:

发布了354 篇原创文章 · 获赞 522 · 访问量 128万+

猜你喜欢

转载自blog.csdn.net/moakun/article/details/103097637
今日推荐