Flume安装配置(超详细,傻瓜式安装)

Flume安装配置

使用的三台主机名称分别为bigdata1,bigdata2,bigdata3。所使用的安装包名称按自己的修改,安装包可去各大官网上下载

1.解压
将Master节点Flume安装包解压到/opt/module目录下

 tar -zxvf /opt/software/apache-flume-1.9.0-bin.tar.gz -C /opt/module/

修改名称为:flume-1.9.0
在module下输入:

mv /apache-flume-1.9.0-bin flume-1.9.0

2.配置

vim /etc/profile

添加

#FLUME
export FLUME_HOME=/opt/module/flume-1.9.0
export PATH=$PATH:$FLUME_HOME/bin
#hive
export HIVE_HOME=/opt/module/hive-3.1.2
export PATH=$PATH:$HIVE_HOME/bin

刷新

source /etc/profile

输入检验环境变量:

flume-ng version

在这里插入图片描述
将flume-env.sh.template改名为flume-env.sh, 并修改其配置
在flume/conf目录下

mv flume-env.sh.template flume-env.sh
vim flume/conf/flume-env.sh 

增加

export JAVA_HOME=/opt/jdk1.8

flume/conf目录下

mv flume-conf.properties.template flume-conf.properties
vim flume-conf.properties

增加

a1.sources = r1
a1.sinks = k1
a1.channels = c1
 
a1.sources.r1.type = exec
a1.sources.r1.command=tail-F/opt/module/hadoop-3.1.3/logs/hadoop-root-namenode-master.log
 
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://bigdata1:9000/tmp/flume/%Y%m%d
a1.sinks.k1.hdfs.filePrefix = log-
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.useLocalTimeStamp = true
 
a1.channels.c1.type = memory
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

flume必须持有hadoop相关的包才能将数据输出到hdfs, 将如下包上传到flume/lib下

cp $HADOOP_HOME/share/hadoop/common/hadoop-common-3.1.3.jar  /opt/flume/lib
cp $HADOOP_HOME/share/hadoop/common/lib/hadoop-auth-3.1.3.jar /opt/flume/lib
cp $HADOOP_HOME/share/hadoop/common/lib/commons-configuration2-2.1.1.jar /opt/flume/lib

将hadoop的hdfs-site.xml和core-site.xml 放到flume/conf下

 rm /opt/flume-1.9.0/lib/guava-11.0.2.jar

3.启动

flume-ng agent --conf conf/ --conf-file /opt/module/flume-1.9.0/conf/flume-conf.properties --name a1  -Dflume.root.logger=DEBUG,console

hdfs dfs -ls /tmp/flume

你可能感兴趣的:(flume,大数据)