Flume的安装与配置

一、       资源下载

资源地址:http://flume.apache.org/download.html

程序地址:http://apache.fayea.com/flume/1.6.0/apache-flume-1.6.0-bin.tar.gz

源码地址:http://mirrors.hust.edu.cn/apache/flume/1.6.0/apache-flume-1.6.0-src.tar.gz

二、       安装搭建

(1)编译好的包:

直接在安装目录解压即可(重命名可选)

cd /usr/local/

tar –zxvf apache-flume-1.6.0-bin.tar.gz

mv apache-flume-1.6.0-bin flume

(2)源码编译安装:

这种方法比较麻烦,要把需要的包都下载全,然后用以下命令编译:

  1. 只进行编译:mvn clean compile
  2. 编译并且执行单元测试:mvn clean test
  3. 单独运行单元测试: mvn clean test -Dtest=<Test1>,<Test2>,... -DfailIfNoTests=false
  4. 创建压缩包: mvn clean install
  5. 跳过单元测试创建压缩包: mvn clean install –DskipTests

编译完成之后,和直接运行可执行包的

三、       运行与配置

(1)flume的配置

# example.conf: A single-node Flume configuration

# Name the components on this agent

a1.sources = r1

a1.sinks = k1

a1.channels = c1

# Describe/configure the source

a1.sources.r1.type = exec

a1.sources.r1.command = tail -F /flume/test.log

# Describe the sink

a1.sinks.k1.type = hdfs

# Use a channel which buffers events in memory

a1.channels.c1.type = memory

a1.channels.c1.capacity = 1000

a1.channels.c1.transactionCapacity = 100

a1.sinks.k1.hdfs.path=hdfs://192.168.15.135:9000/flume/events/%y-%m-%d/%H%M/%S

a1.sinks.k1.hdfs.filePrefix = events-

a1.sinks.k1.hdfs.round = true

a1.sinks.k1.hdfs.roundValue = 10

a1.sinks.k1.hdfs.roundUnit = minute

a1.sinks.k1.hdfs.useLocalTimeStamp = true

# Bind the source and sink to the channel

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

配置文件分为四个部分source、sink、channel和它们之间的关联关系;flume之间模块的关系如下图:

如图:source是负责从WebServer收集数据信息,Sink负责将收集和格式化后的日志写入到磁盘、其他文件系统或其他日志系统,channel是负责连接source和sink。因为有channel的存在,所以source和sink是多对多的关系。

# example.conf: A single-node Flume configuration

# Name the components on this agent

a1是代理的名字

a1.sources = r1

定义一个source:r1

a1.sinks = k1

定义一个sink:k1

a1.channels = c1

定义一个channel:c1

# Describe/configure the source

a1.sources.r1.type = exec

a1的r1的类型为exec(执行类型)

a1.sources.r1.command = tail -F /flume/test.log

a1的r1要执行的命令为tail一个test.log

# Describe the sink

a1.sinks.k1.type = hdfs

a1的sink类型为hdfs

# Use a channel which buffers events in memory

a1.channels.c1.type = memory

a1的channel的类型为存在内存

a1.channels.c1.capacity = 1000

a1的容量为1000

a1.channels.c1.transactionCapacity = 100

a1的交互容量为100

a1.sinks.k1.hdfs.path=hdfs://192.168.15.135:9000/flume/events/%y-%m-%d/%H%M/%S

a1的叫k1的sink的最终存储的文件系统的路径是:hdfs://……

a1.sinks.k1.hdfs.filePrefix = events-

sink在存储文件的时候的前缀为event-

a1.sinks.k1.hdfs.round = true

hdfs配置项

a1.sinks.k1.hdfs.roundValue = 10

hdfs配置项

a1.sinks.k1.hdfs.roundUnit = minute

hdfs配置项

a1.sinks.k1.hdfs.useLocalTimeStamp = true

将用本地时间戳设置为true

# Bind the source and sink to the channel

a1.sources.r1.channels = c1

把source-r1绑定到channel-c1

a1.sinks.k1.channel = c1

把sink-k1绑定到channel-c1

(2)flume的运行方法为:

$ bin/flume-ng agent -n $agent_name -c conf -f conf/flume-conf.properties

-n  指定代理(agent)名字;

-c  conf指定配置文件的目录(主要是日志等其他配置文件的目录);

-f  本次运行的flume的配置文件,需要添加路径(模式是在工程的根路径flume/)

执行命令例如:

$ bin/flume-ng agent -n a1 -c conf -f conf/example.conf

执行成功之后,我们可以在logs的flume.log中看到日志。

另外,还可以用以下方式启动,来指定日志输出:

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

--conf :与-c相同;

--conf-file :与-f相同;

--name:与-n相同;

flume.root.logger:指定日志级别和显示方式,上述命令为INFO,输出到终端;如果没有此项,像之前的命令一样,默认的级别是INFO,输出到LOGFILE。

四、       备注

(1)可选的source有:

(2)可选的sink有:

详细配置参考:http://flume.apache.org/FlumeUserGuide.html#flume-sources

Flume的安装与配置的更多相关文章

  1. Flume的安装,配置及使用

    1,上传jar包 2,解压 3,改名 4,更改配置文件 将template文件重镜像 root@Ubuntu-1:/usr/local/apache-flume/conf# cat flume-env ...

  2. Flume简介与使用(一)——Flume安装与配置

    Flume简介与使用(一)——Flume安装与配置 Flume简介 Flume是一个分布式的.可靠的.实用的服务——从不同的数据源高效的采集.整合.移动海量数据. 分布式:可以多台机器同时运行采集数据 ...

  3. CentOS6安装各种大数据软件 第七章:Flume安装与配置

    相关文章链接 CentOS6安装各种大数据软件 第一章:各个软件版本介绍 CentOS6安装各种大数据软件 第二章:Linux各个软件启动命令 CentOS6安装各种大数据软件 第三章:Linux基础 ...

  4. 使用Windows Azure的VM安装和配置CDH搭建Hadoop集群

    本文主要内容是使用Windows Azure的VIRTUAL MACHINES和NETWORKS服务安装CDH (Cloudera Distribution Including Apache Hado ...

  5. Flume NG简介及配置

    Flume下载地址:http://apache.fayea.com/flume/ 常用的分布式日志收集系统: Apache Flume. Facebook Scribe. Apache Chukwa ...

  6. 浅谈 zookeeper 原理,安装和配置

    当前云计算流行, 单一机器额的处理能力已经不能满足我们的需求,不得不采用大量的服务集群.服务集群对外提供服务的过程中,有很多的配置需要随时更新,服务间需要协调工作,那么这些信息如何推送到各个节点?并且 ...

  7. 一脸懵逼学习基于CentOs的Hadoop集群安装与配置

    1:Hadoop分布式计算平台是由Apache软件基金会开发的一个开源分布式计算平台.以Hadoop分布式文件系统(HDFS)和MapReduce(Google MapReduce的开源实现)为核心的 ...

  8. 日志采集框架Flume以及Flume的安装部署(一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统)

    Flume支持众多的source和sink类型,详细手册可参考官方文档,更多source和sink组件 http://flume.apache.org/FlumeUserGuide.html Flum ...

  9. 一脸懵逼学习基于CentOs的Hadoop集群安装与配置(三台机器跑集群)

    1:Hadoop分布式计算平台是由Apache软件基金会开发的一个开源分布式计算平台.以Hadoop分布式文件系统(HDFS)和MapReduce(Google MapReduce的开源实现)为核心的 ...

随机推荐

  1. KVC实现原理简介

    KVC,全称:Key-Value-Coding. KVC运用了isa-swizzling技术.isa-swizzling就是类型混合指针机制.KVC主要通过isa-swizzling来实现其内部定位查 ...

  2. iOS设计模式之组合模式

    组合模式(Composite) 基本理解 整体和部分可以一直对待. 组合模式:将对象组合成树形结构以表示"部分--整体"的层次结构.组合模式使得用户对单个对象和组合独享的使用具有一 ...

  3. 用Qt开发第一个Hello World程序

    配置好Qt的环境变量之后,我们才可以进行下面的通过终端来使用Qt开发这个第一个程序 因为Qt的文件路径不能有中文否则会报错,所以一般都把工程文件都建立在根目录 我们创建的Qt程序包含两个部分:1.GU ...

  4. Effective Java 47 Know and use the libraries

    Advantages of use the libraries By using a standard library, you take advantage of the knowledge of ...

  5. jQuery Validate 表单验证插件----在class属性中添加校验规则进行简单的校验

    一.下载插件包. 网盘下载:https://yunpan.cn/cryvgGGAQ3DSW  访问密码 f224 二.jQuery表单验证插件----添加class属性形式的校验 <!DOCTY ...

  6. [转载]iTOP-4412开发板搭建最小linux系统

    本文转迅为电子论坛:http://www.topeetboard.com 最小linux系统所需资料下载:http://pan.baidu.com/s/1kTNan0j 开发板不仅可以运行Androi ...

  7. NOI2016 山西省省选 第二题序列

    给出一个n(n<=10^18)然后把n拆成若干个数之和(3=1+2=2+1 是两种情况) 然后把这写数字当作斐波那契数列的下标相乘再相加 例如: 3=1+1+1=1+2=2+1=3 所以结果就是 ...

  8. MIT jos 6.828 Fall 2014 训练记录(lab 3)

    注:源代码参见我的github: https://github.com/YaoZengzeng/jos Part A : User Environments and Exception Handlin ...

  9. 双向广搜 codevs 3060 抓住那头奶牛

    codevs 3060 抓住那头奶牛 USACO  时间限制: 1 s  空间限制: 16000 KB  题目等级 : 黄金 Gold   题目描述 Description 农夫约翰被告知一头逃跑奶牛 ...

  10. 平摊分析 Amortized Analysis ------geeksforgeeks翻译

    当偶尔一切操作很花的时间很慢,而大多数操作的时间都很快的时候,平摊分析的方法就很很好用了.在平摊分析中,我们分析一串操作并且可以得到最坏情况下的平均时间复杂度.例如hash table, disjoi ...