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. OC语言-08-深拷贝与浅拷贝详解(示例)

    概述 拷贝:复制一个与源对象内容相同的对象 实现拷贝,需要遵守以下两个协议 NSCopying NSMutableCopying 拷贝返回对象的种类 可变,mutableCopy消息返回的对象 不可变 ...

  2. C++语言出现的bug

    输出语句不管是C语言的printf();还是cout << "" << endl; 在循环语句中会出现一个bug: 下面是不正常的两种情况: 下面是正常的: ...

  3. Linux文件I/O学习

    Linux内核的VFS子系统: 文件描述符     对于内核而言,所有打开的文件都通过文件描述符引用.文件描述符是一个非负整数.当打开一个现有文件或创建一个新文件时,内核向进程返回一个文件描述符.当读 ...

  4. [转载] 关于PreparedStatement.addBatch()方法

    Statement和PreparedStatement的区别就不多废话了,直接说PreparedStatement最重要的addbatch()结构的使用. 1.建立链接(打电话拨号) Connecti ...

  5. Effective Java 08 Obey the general contract when overriding equals

    When it's the case that each instance of the class is equal to only itself. 1. Each instance of the ...

  6. HTTPS的七个误解

    转自:http://www.ruanyifeng.com/blog/2011/02/seven_myths_about_https.html 开发网页的时候,往往需要观察HTTP通信. 我使用的工具主 ...

  7. 命令行方式使用abator.jar生成ibatis相关代码和sql语句xml文件

    最近接手一个老项目,使用的是数据库是sql server 2008,框架是springmvc + spring + ibatis,老项目是使用abator插件生成的相关代码,现在需要增加新功能,要添加 ...

  8. Linux 安装 redis

      环境:centos7 参考:http://blog.csdn.net/lk10207160511/article/details/50364088 步骤如下: 安装redis: 打开终端 输入 s ...

  9. Linux 下从头再走 GTK+-3.0 (六)

    在 GTK3 中增加了一个 GtkApplicaton 类,便于我们处理多窗口程序,同时有了 GtkApplication 我们也更容易创建灵活,易用,界面美观的应用程序. 在前面的几个例子中,演示了 ...

  10. centos6.7 安装Docker

      一.查看系统版本 [root@localhost ~]# cat /etc/redhat-release CentOS release 6.7 (Final) 二.安装EPEL 1.进入cento ...