美文网首页
[翻译中] Apache Flume 介绍

[翻译中] Apache Flume 介绍

作者: 翼徳 | 来源:发表于2018-11-12 10:59 被阅读8次

    概述

    Apache Flume 是一个分布式、可靠、可用的系统,用于从大量不同的源有效地收集、聚合、移动大量日志数据到集中式数据存储。

    Apache Flume 的使用不仅限于日志数据聚合。由于数据源是可定制的,Flume 可用于传输大量的事件数据,包括但不限于网络流量数据,社交媒体生成的数据,电子邮件消息和几乎任何可能的数据源。

    Apache Flume 是 Apache Software Foundation 的顶级项目。

    目前有两个版本代码行,版本 0.9.x 和 1.x.
    0.9.x 的文档可在 Flume 0.9.x 用户指南 中找到。

    推荐新用户和现有用户使用 1.x 版本,以便利用最新架构中可用的性能改进和配置灵活性。

    系统要求

    • JRE - Java 1.7 或更高版本
    • 内存 - 用于源,通道或接收器使用的配置的足够内存
    • 磁盘空间 - 用于通道或接收器使用的配置的足够磁盘空间
    • 目录权限 - 代理使用的目录的读/写权限

    数据流模型

    Flume 数据流模型

    Flume event 是由字节或字符串组成的数据流单元。 Flume Agent 是承载Event 从外部 Source 流向下一个目标(hop)组件的(JVM)进程。

    Flume Source 接收由外部 Source (如Web服务器)传递给它的事件。外部 Source 以目标 Flume Source 识别的格式向 Flume 发送 event。例如,Avro Flume source 可以用于接收由 Avro 客户端或 Avro Sink 所发送 event 的流中的其他 Flume Agent 的 Avro event。类似的流程可以使用 Thrift Flume Source 来定义,以接收来自 Thrift Sink 或 Flume Thrift Rpc 客户端或 Thrift 客户端的 event,这些客户端用从 Flume thrift 协议生成的任何语言编写。当 Flume Source 接收到 evnet 时,它将它存储一个或多个Channel 。Channel 是一个被动存储的空间,它将 event 保存到被 Flume Sink 消费为止。以 File channel 为例 - 它由本地文件系统支持。Sink 从 Channel 中删除 event,并将其放入外部仓库(如 HDFS,通过 Flume HDFS Sink)或将其转发到流中的下一个 Flume Agent 的 Flume Source。给定 Agent 中的 Source 和 Sink 与 Channel 中暂存的 event 异步运行。

    复杂流

    Flume 允许用户构建 multi-hop 流,其中 event 在到达最终目的地之前经过多个 agent。它还允许 fan-in 和 fan-out 流,上下文路由和故障转移。

    可靠性

    Event 在每个 agent 的 channel 中暂存。然后将 event 传递到流中的下一个 agent 或终端仓库(如HDFS)。只有在 event 存储在下一 agent 的 channel 中或终端仓库中之后,才从 channel 中删除 event。这便是 Flume 的 single-hop 消息传递语义如何提供流的端到端的可靠性。

    Flume uses a transactional approach to guarantee the reliable delivery of the events. The sources and sinks encapsulate in a transaction the storage/retrieval, respectively, of the events placed in or provided by a transaction provided by the channel. This ensures that the set of events are reliably passed from point to point in the flow. In the case of a multi-hop flow, the sink from the previous hop and the source from the next hop both have their transactions running to ensure that the data is safely stored in the channel of the next hop.

    Flume 使用事务的方式来保证 event 可靠传递。Source 和 sink 封装在事务中,存储、检索由 source 提供的事务放置或提供的 event。确保 event 集合可靠地点到点的在流中传递。在 multi-hop 流的情况下,来自前一跳的 sink 和来自下一跳的 source 都使它们的事务运行,以确保数据安全地存储在下一跳的 channel 中。

    Recoverability

    The events are staged in the channel, which manages recovery from failure. Flume supports a durable file channel which is backed by the local file system. There’s also a memory channel which simply stores the events in an in-memory queue, which is faster but any events still left in the memory channel when an agent process dies can’t be recovered.

    相关文章

      网友评论

          本文标题:[翻译中] Apache Flume 介绍

          本文链接:https://www.haomeiwen.com/subject/avmhgttx.html