Flume安装-配置-调试
来源:互联网 发布:帝国文明源码下载 编辑:程序博客网 时间:2024/05/20 00:17
第一章:准备安装包
apache-flume-1.6.0-bin.tar.gz 安装包
第二章:安装环境
1.Linux虚拟机Centos 7.0,服务器CPU:i5 双核以上,内存:2G以上
2.JDK1.7.0以上、Hadoop -2.7 .1、
3.机器名 ip地址 安装软件
Master1 192.168.114.38
Slave1 192.168.114.39
Slave1 192.168.114.40
第三章:软件安装
1、软件解压:
将软件包放在/data目录下,并解压到/soft目录下,拷贝集群上的hadoop安装文件到/so ft目录下
2、添加环境变量:
Master1 192.168.114.38
Slave1 192.168.114.39
Slave1 192.168.114.40
所有机器vim /etc/profile 向文件中添加以下变量:
export HADOOP_HOME=/soft/hadoop-2.7.1
exportPATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
exportFLUME_HOME=/soft/apache-flume-1.6.0-bin/
export PATH=$PATH:$FLUME_HOME/bin
保存退出,并使文件生效:
3、复制flume到其他节点
cd /soft/
scp -r apache-flume-1.6.0-binroot@192.168.114.39: /soft
scp -r apache-flume-1.6.0-binroot@192.168.114.40: /soft
5、配置agent启动文件
Master1节点上,在flume conf目录中flume-conf.properties.template重命名为agent0.conf
修改为以下内容:
agent0.sources = source1
agent0.channels = memoryChannel
agent0.sinks = sink1
agent0.sources.source1.type = avro
agent0.sources.source1.bind =192.168.114.38
agent0.sources.source1.port = 23004
agent0.sources.source1.channels =memoryChannel
agent0.sources.source1.interceptors = i1
agent0.sources.source1.interceptors.i1.type= timestamp
agent0.channels.memoryChannel.type = memory
agent0.channels.memoryChannel.capacity =2000
agent0.channels.memoryChannel.keep-alive =100
agent0.sinks.sink1.type = hdfs
agent0.sinks.sink1.hdfs.path =hdfs://192.168.114.20:8020/input/%y-%m-%d
agent0.sinks.sink1.hdfs.fileType =DataStream
agent0.sinks.sink1.hdfs.writeFormat = TEXT
agent0.sinks.sink1.hdfs.rollInterval = 1
agent0.sinks.sink1.hdfs.rollSize = 400000
agent0.sinks.sink1.hdfs.rollCount = 100
agent0.sinks.sink1.channel = memoryChannel
agent0.sinks.sink1.hdfs.filePrefix =events-
如下图所示:
(注:rollCount不设置的话默认是10行,上传的文件内容如果多于10行,会被切分成两个文件,适当改大些.
source1.port端口选用前查看该端口是否被占用:netstat -tunlp | grep 23004)
slave1节点上,在flume conf目录中flume-conf.properties.template重命名为agent1.conf
vim agent1.conf
修改为以下内容:
agent1.sources= source1
agent1.channels=Channel1
agent1.sinks= sink1
#agent1.sources.source1.type= spooldir
agent1.sources.source1.type= exec
#agent1.sources.source1.spoolDir= /usr/local/flumelog
agent1.sources.source1.command= tail -F /usr/local/flumelog/flume_test1.txt
agent1.sources.source1.channels=Channel1
agent1.channels.Channel1.type= file
agent1.channels.Channel1.checkpointDir= /usr/local/tmp/checkpoint
agent1.channels.Channel1.dataDirs= /usr/local/tmp/datadir
agent1.sinks.sink1.type= avro
agent1.sinks.sink1.hostname= 192.168.114.38
agent1.sinks.sink1.port= 23004
agent1.sinks.sink1.channel=Channel1
如下图所示:
Slave2节点上,在flume conf目录中flume-conf.properties.template重命名为agent2.conf
vim agent2.conf
修改内容为:
agent2.sources= source1
agent2.channels=Channel1
agent2.sinks= sink1
agent2.sources.source1.type= spooldir
agent2.sources.source1.spoolDir= /usr/local/flumelog
agent2.sources.source1.channels=Channel1
agent2.channels.Channel1.type= file
agent2.channels.Channel1.checkpointDir= /usr/local/tmp/checkpoint
agent2.channels.Channel1.dataDirs= /usr/local/tmp/datadir
agent2.sinks.sink1.type= avro
agent2.sinks.sink1.hostname= 192.168.114.38
agent2.sinks.sink1.port= 23004
agent2.sinks.sink1.channel=Channel1
如下图所示:
6、启动flume
进入当前机器flume 目录下面进行启动,先启动master1节点的flume,不然会报异常,并且确保hadoop之前是启动的
在/soft/apache-flume-1.6.0-bin/下分别启动:
master1: flume-ng agent--conf ./conf/ -f ./conf/agent0.conf -n agent0 -Dflume.root.logger=INFO,console
slave1:flume-ng agent--conf ./conf/ -f ./conf/agent1.conf -n agent1 -Dflume.root.logger=INFO,console
slave2:flume-ng agent--conf ./conf/ -f ./conf/agent2.conf -n agent2 -Dflume.root.logger=INFO,console
(注意此处的-n agent0名称对应agent0.conf中的agent0)
第四章、测试Flume功能
3台机器服务都启动之后, 可以往 slave1或者slave2 机器中的 文件夹下面(配置好的spooldir路径)加入新的文件,flume 集群会将这些数据 都收集到master1上面,然后写到hdfs 中
- Flume安装-配置-调试
- 【配置】flume安装配置
- flume安装及配置
- flume安装及配置
- flume安装配置
- flume安装及配置
- Flume安装和配置
- flume安装配置
- flume安装配置手册
- 安装配置flume
- Flume安装配置
- Flume 安装与配置
- flume简单安装配置
- Flume安装配置实践
- Linux安装配置Flume
- Flume安装配置笔记
- 2.Flume安装配置
- flume安装与配置
- Android ffmpeg 3.4 JNI移植 NDK编译播放 ffserver 推送的 Rtsp 视频流
- 【学习贴】Ps终极动画练习
- 五子棋人机
- Python3-搭建Django框架
- windows 2003系统下邮件系统搭建
- Flume安装-配置-调试
- workerman中使用aes加密
- MyBatis Mapper XML 符号处理
- c#反射中GetMethods()和GetCustomAttributes()方法
- nmap核心结构概述
- 几十部以程序员为主角的影片
- leetcode24. Swap Nodes in Pairs
- Java编程思想笔记-二
- 未来五年最具前景的一门编程语言是什么?