• Flume的安装配置


    flume是一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统。支持在日志系统中定制各类数据发送方,用于收集数据;同时,Flume提供对数据进行简单处理,并写到各种数据接受方(比如文本、HDFS、Hbase等)的能力 。

    一、什么是Flume?
      flume 作为 cloudera 开发的实时日志收集系统,受到了业界的认可与广泛应用。Flume 初始的发行版本目前被统称为 Flume OG(original generation),属于 cloudera。但随着 FLume 功能的扩展,Flume OG 代码工程臃肿、核心组件设计不合理、核心配置不标准等缺点暴露出来,尤其是在 Flume OG 的最后一个发行版本 0.94.0 中,日志传输不稳定的现象尤为严重,为了解决这些问题,2011 年 10 月 22 号,cloudera 完成了 Flume-728,对 Flume 进行了里程碑式的改动:重构核心组件、核心配置以及代码架构,重构后的版本统称为 Flume NG(next generation);改动的另一原因是将 Flume 纳入 apache 旗下,cloudera Flume 改名为 Apache Flume。
     
    flume的特点:
      flume是一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统。支持在日志系统中定制各类数据发送方,用于收集数据;同时,Flume提供对数据进行简单处理,并写到各种数据接受方(比如文本、HDFS、Hbase等)的能力 。
      flume的数据流由事件(Event)贯穿始终。事件是Flume的基本数据单位,它携带日志数据(字节数组形式)并且携带有头信息,这些 Event由Agent外部的Source生成,当Source捕获事件后会进行特定的格式化,然后Source会把事件推入(单个或多 个)Channel中。你可以把Channel看作是一个缓冲区,它将保存事件直到Sink处理完该事件。Sink负责持久化日志或者把事件推向另一个 Source。
     
    flume的可靠性
      当节点出现故障时,日志能够被传送到其他节点上而不会丢失。Flume提供了三种级别的可靠性保障,从强到弱依次分别为:end-to-end(收到 数据agent首先将event写到磁盘上,当数据传送成功后,再删除;如果数据发送失败,可以重新发送。),Store on failure(这也是scribe采用的策略,当数据接收方crash时,将数据写到本地,待恢复后,继续发送),Besteffort(数据发送到接 收方后,不会进行确认)。
     
    flume的可恢复性:
      还是靠Channel。推荐使用FileChannel,事件持久化在本地文件系统里(性能较差)。
     
      flume的一些核心概念:
    Agent使用JVM 运行Flume。每台机器运行一个agent,但是可以在一个agent中包含多个sources和sinks。
    Client生产数据,运行在一个独立的线程。
    Source从Client收集数据,传递给Channel。
    Sink从Channel收集数据,运行在一个独立线程。
    Channel连接 sources 和 sinks ,这个有点像一个队列。
    Events可以是日志记录、 avro 对象等。
     
      Flume以agent为最小的独立运行单位。一个agent就是一个JVM。单agent由Source、Sink和Channel三大组件构成,如下图:

      值得注意的是,Flume提供了大量内置的Source、Channel和Sink类型。不同类型的Source,Channel和Sink可 以自由组合。组合方式基于用户设置的配置文件,非常灵活。比如:Channel可以把事件暂存在内存里,也可以持久化到本地硬盘上。Sink可以把日志写 入HDFS, HBase,甚至是另外一个Source等等。Flume支持用户建立多级流,也就是说,多个agent可以协同工作,并且支持Fan-in、Fan- out、Contextual Routing、Backup Routes,这也正是NB之处。如下图所示:

      二、flume的官方网站在哪里?
      http://flume.apache.org/

      三、在哪里下载?

      http://www.apache.org/dyn/closer.cgi/flume/1.5.0/apache-flume-1.6.0-bin.tar.gz

      四、如何安装?
        1)将下载的flume包,解压到/home/hadoop目录中,你就已经完成了50%:)简单吧

        2)修改 flume-env.sh 配置文件,主要是JAVA_HOME变量设置

    root@m1:/home/hadoop/flume-1.5.0-bin# cp conf/flume-env.sh.template conf/flume-env.sh
    root@m1:/home/hadoop/flume-1.5.0-bin# vi conf/flume-env.sh
    # Licensed to the Apache Software Foundation (ASF) under one
    # or more contributor license agreements. See the NOTICE file
    # distributed with this work for additional information
    # regarding copyright ownership. The ASF licenses this file
    # to you under the Apache License, Version 2.0 (the
    # "License"); you may not use this file except in compliance
    # with the License. You may obtain a copy of the License at
    #
    #   http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
      
    # If this file is placed at FLUME_CONF_DIR/flume-env.sh, it will be sourced
    # during Flume startup.
      
    # Enviroment variables can be set here.
      
    JAVA_HOME=/usr/lib/jvm/java-7-oracle
      
    # Give Flume more memory and pre-allocate, enable remote monitoring via JMX
    #JAVA_OPTS="-Xms100m -Xmx200m -Dcom.sun.management.jmxremote"
      
    # Note that the Flume conf directory is always included in the classpath.
    #FLUME_CLASSPATH=""

        3)验证是否安装成功

    root@m1:/home/hadoop# /home/hadoop/flume-1.5.0-bin/bin/flume-ng version
    Flume 1.5.0
    Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
    Revision: 8633220df808c4cd0c13d1cf0320454a94f1ea97
    Compiled by hshreedharan on Wed May 7 14:49:18 PDT 2014
    From source with checksum a01fe726e4380ba0c9f7a7d222db961f
    root@m1:/home/hadoop#

       出现上面的信息,表示安装成功了.

  • 相关阅读:
    两指针--减少数组循环
    python与正则表达式
    python 获取网页图片
    python学习 第一天
    jquery中的基本理解以及样式属性操作
    webapi中的三大家族
    BOM中的其他对象以及短路运算
    BOM中的api
    事件冒泡和事件捕获
    webapi中注册事件以及解绑事件
  • 原文地址:https://www.cnblogs.com/gaopeng527/p/4968728.html
Copyright © 2020-2023  润新知