Hadoop 搭建Flume环境

2021-07-25  本文已影响0人  Yohann丶blog
1551627192148_.pic.jpg

环境

安装Flume

$ wget http://archive.apache.org/dist/flume/1.5.2/apache-flume-1.5.2-bin.tar.gz
$ tar -xzf apache-flume-1.5.2-bin.tar.gz
$ mv apache-flume-1.5.2-bin /app/flume-1.5.2

解压后,将 apache-flume-1.5.2-bin 移动到 /app 目录下,并命名为 flume-1.5.2。

$ sudo vi /etc/profile
export FLUME_HOME=/app/flume-1.5.2
export FLUME_CONF_DIR=$FLUME_HOME/conf
export PATH=$PATH:$FLUME_HOME/bin
$ source /etc/profile

配置Flume

$ cd /app/flume-1.5.2/conf
$ cp flume-env.sh.template flume-env.sh
JAVA_HOME= /app/lib/jdk1.7.0_55
JAVA_OPTS="-Xms100m -Xmx200m -Dcom.sun.management.jmxremote"

修改以上两项配置。

验证配置完成

$ cp flume-conf.properties.template flume-conf.properties
# The configuration file needs to define the sources, the channels and the sinks.
# Sources, channels and sinks are defined per agent, in this case called 'a1'
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# For each one of the sources, the type is defined
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

#The channel can be defined as follows.
a1.sources.r1.channels = c1
# Each sink's type must be defined
a1.sinks.k1.type = logger

#Specify the channel the sink should use
a1.sinks.k1.channel = c1

# Each channel's type is defined.
a1.channels.c1.type = memory
# Other config values specific to each type of channel(sink or source)
# can be defined as well
# In this case, it specifies the capacity of the memory channel
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
$ ./bin/flume-ng agent --conf ./conf/ --conf-file  ./conf/flume-conf.properties --name a1 -Dflume.root.logger=INFO,console
$ curl localhost:44444
OK
上一篇 下一篇

猜你喜欢

热点阅读