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. nodejs socket

    server.js var net = require('net'); var clientList = []; var HOST = '127.0.0.1'; var PORT = 6969; va ...

  2. Apache Shiro 简介

    使用 Apache Shiro 为 web 应用程序进行用户身份验证 Shiro 是一个 Apache Incubator 项目,旨在简化身份验证和授权.在本文中,了解 Apache Shiro 并通 ...

  3. MongoDB学习笔记——聚合操作之聚合管道(Aggregation Pipeline)

    MongoDB聚合管道 使用聚合管道可以对集合中的文档进行变换和组合. 管道是由一个个功能节点组成的,这些节点用管道操作符来进行表示.聚合管道以一个集合中的所有文档作为开始,然后这些文档从一个操作节点 ...

  4. .NET 分页

    .net分页 1.存储过程create procedure 存储过程名( @pageIndex int,                         //第几页 @pageSize int     ...

  5. .NET(C#)中不同级别的安全透明代码对类型的影响

    测试代码将测试一个方法和类默认在全部信任权限下和部分信任权限下的代码类型. 上面说的默认就是指未加入其他安全透明类型的特性. 代码类型可以是: 透明代码(Transparent Code) 关键代码( ...

  6. cocos2d-x之计时器初试

    bool HelloWorld::init() { if ( !Layer::init() ) { return false; } Size visibleSize = Director::getIn ...

  7. poj 1050 To the Max(最大子矩阵之和,基础DP题)

    To the Max Time Limit: 1000MSMemory Limit: 10000K Total Submissions: 38573Accepted: 20350 Descriptio ...

  8. WCF MSMQ消息队列与离线操作

    消息队列类型 公共队列:整个网络中的节点都可以访问到 专用队列:本地计算机,知道路径者可以访问 管理队列:包含确认在给定“消息队列”网络中的发送的消息回执的消息 相应队列:返回给发送程序的相应信息

  9. Snowflake weakness and type2 fact table

    DimProduct DimSubcategory Dimcategory productpk subcategorypk categorypk sku subcategoryName categor ...

  10. 【ASP.NET 基础】Page类和回调技术

    Page 类有一个 IsPostBack 属性,这个属性用来指示当前页面是第一次加载还是响应了页面上某个控件的服务器事件导致回发而加载. 1.asp.net页面的声明周期 asp.net页面运行的时候 ...