您的位置:首页 > 其它

从无到有系列之flume-安装部署01

2016-11-17 17:29 218 查看
[align=left]1.下载flume并解压:     wget 命令下载[/align]
wget http://www.apache.org/dyn/closer.cgi/flume/1.6.0/apache-flume-1.6.0-bin.tar.gz 手动下载: http://flume.apache.org/download.html
2.解压:tar zxf     apache-flume-1.6.0-bin.tar.gz

[align=left](1)添加环境变量 gedit/etc/profile[/align]
[align=left]#forflume1.6.0[/align]
[align=left]exportFLUME_HOME=/home/hadoop/apache-flume-1.6.0-bin[/align]
[align=left]exportFLUME_CONF_DIR=$FLUME_HOME/conf[/align]
[align=left]exportPATH=$PATH:$FLUME_HOME/bin[/align]
(2)配置flume-env.sh文件
在$FLUME_HOME/conf     下复制改名flume-env.sh.template为flume-env.sh

 cp     flume-env.sh.template flume-env.sh
(3)修改JAVA_HOME和JAVA_OPTS    

[align=left]exportJAVA_HOME=/home/hadoop/jdk1.7.0_75[/align]
[align=left]exportJAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote"[/align]
3.flume的测试(一)telnet运行控制台输出
在$FLUME_HOME/conf目录下修改flume-conf.properties.template文件,复制并改
名为flume-conf  

[align=left]#example.conf: A single-node Flume configuration[/align]
# Namethe 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 achannel which buffers events in memory

a1.channels.c1.type = memory

a1.channels.c1.capacity = 1000

a1.channels.c1.transactionCapacity = 100
# Bindthe source and sink to the channel

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1
4.在flume的安装目录/apache-flume-1.6.0-bin下运行

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




5.再打开一个终端,输入命令:telnet
localhost     44444,输入“hello world”


6.[b]再看另一个终端是否有信息hello world打印出来[/b]





[b]本文参考转载至:http://flume.apache.org/FlumeUserGuide.html    http://f.dataguru.cn/thread-523804-1-1.html[/b]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: