1、selector

http://blog.csdn.net/looklook5/article/details/40430965

http://blog.csdn.net/xiao_jun_0820/article/details/38116103#

选择器可以工作在复制 多路复用(路由) 模式下

复制模式
        属性说明:
            selector.type replicating 类型名称,必须是 replicating
            selector.optional    –    标志通道为可选

多路复用(路由)模式
            属性说明:
                selector.type    类型,必须是"multiplexing"
                selector.header    指定要监测的头的名称    
                selector.default    –    
                selector.mapping.*    –
            举例:
                a1.sources = r1
                a1.channels = c1 c2 c3 c4
                a1.sources.r1.selector.type = multiplexing
                a1.sources.r1.selector.header = state
                a1.sources.r1.selector.mapping.CZ = c1
                a1.sources.r1.selector.mapping.US = c2 c3
                a1.sources.r1.selector.default = c4

8.Processor
    1.概述
        Sink Group允许用户将多个Sink组合成一个实体。
        Flume Sink Processor 可以通过切换组内Sink用来实现负载均衡的效果,或在一个Sink故障时切换到另一个Sink。

sinks    –    用空格分隔的Sink集合
        processor.type    default    类型名称,必须是 default、failover 或 load_balance

2.Default Sink Processor
        Default Sink Processor 只接受一个 Sink。
        不要求用户为单一Sink创建processor

3.Failover Sink Processor
        Failover Sink Processor 维护一个sink们的优先表。确保只要一个是可用的就事件就可以被处理。
        失败处理原理是,为失效的sink指定一个冷却时间,在冷却时间到达后再重新使用。
        sink们可以被配置一个优先级,数字越大优先级越高。
        如果sink发送事件失败,则下一个最高优先级的sink将会尝试接着发送事件。
        如果没有指定优先级,则优先级顺序取决于sink们的配置顺序,先配置的默认优先级高于后配置的。
        在配置的过程中,设置一个group processor ,并且为每个sink都指定一个优先级。
        优先级必须是唯一的。
        另外可以设置maxpenalty属性指定限定失败时间。

sinks    –    Space-separated list of sinks that are participating in the group
        processor.type    default    The component type name, needs to be failover
        processor.priority.<sinkName>    –    Priority value. <sinkName> must be one of the sink instances associated with the current sink group A higher priority value Sink gets activated earlier. A larger absolute value indicates higher priority
        processor.maxpenalty    30000    The maximum backoff period for the failed Sink (in millis)

Example for agent named a1:
        ------
        a1.sinkgroups = g1
        a1.sinkgroups.g1.sinks = k1 k2
        a1.sinkgroups.g1.processor.type = failover
        a1.sinkgroups.g1.processor.priority.k1 = 5
        a1.sinkgroups.g1.processor.priority.k2 = 10
        a1.sinkgroups.g1.processor.maxpenalty = 10000
        ------
    
    4.Load balancing Sink Processor
        Load balancing Sink processor 提供了在多个sink之间实现负载均衡的能力。
        它维护了一个活动sink的索引列表。
        它支持轮询 或 随机方式的负载均衡,默认值是轮询方式,可以通过配置指定。
        也可以通过实现AbstractSinkSelector接口实现自定义的选择机制。

!processor.sinks    –    Space-separated list of sinks that are participating in the group
        !processor.type    default    The component type name, needs to be load_balance
        processor.backoff    false    Should failed sinks be backed off exponentially.
        processor.selector    round_robin    Selection mechanism. Must be either round_robin, random or FQCN of custom class that inherits from AbstractSinkSelector
        processor.selector.maxTimeOut    30000    Used by backoff selectors to limit exponential backoff (in milliseconds)

------
        a1.sinkgroups = g1
        a1.sinkgroups.g1.sinks = k1 k2
        a1.sinkgroups.g1.processor.type = load_balance
        a1.sinkgroups.g1.processor.backoff = true
        a1.sinkgroups.g1.processor.selector = random
        ------

9.Interceptors - 拦截器
    1.概述
        Flume有能力在运行阶段修改/删除Event,这是通过拦截器(Interceptors)来实现的。
        拦截器需要实现org.apache.flume.interceptor.Interceptor接口。
        拦截器可以修改或删除事件基于开发者在选择器中选择的任何条件。
        拦截器采用了责任链模式,多个拦截器可以按指定顺序拦截。
        一个拦截器返回的事件列表被传递给链中的下一个拦截器。
        如果一个拦截器需要删除事件,它只需要在返回的事件集中不包含要删除的事件即可。
        如果要删除所有事件,只需返回一个空列表。
        
    2.Timestamp Interceptor
        这个拦截器在事件头中插入以毫秒为单位的当前处理时间。
        头的名字为timestamp,值为当前处理的时间戳。
        如果在之前已经有这个时间戳,则保留原有的时间戳。

参数说明:
            !type    –    类型名称,必须是timestamp或自定义类的全路径名
            preserveExisting    false    如果时间戳已经存在是否保留

3.Host Interceptor
        这个拦截器插入当前处理Agent的主机名或ip
        头的名字为host或配置的名称
        值是主机名或ip地址,基于配置。

参数说明:
            !type    –    类型名称,必须是host
            preserveExisting    false    如果主机名已经存在是否保留
            useIP    true    如果配置为true则用IP,配置为false则用主机名
            hostHeader    host    加入头时使用的名称

4.Static Interceptor
        此拦截器允许用户增加静态头信息使用静态的值到所有事件。
        目前的实现中不允许一次指定多个头。
        如果需要增加多个静态头可以指定多个Static interceptors
        属性说明:
            !type    –    类型,必须是static
            preserveExisting    true    如果配置头已经存在是否应该保留
            key    key    要增加的透明
            value    value    要增加的头值

5.UUID Interceptor
        这个拦截器在所有事件头中增加一个全局一致性标志。
        其实就是UUID。

属性说明:
            !type    –    类型名称,必须是org.apache.flume.sink.solr.morphline.UUIDInterceptor$Builder
            headerName    id    头名称
            preserveExisting    true    如果头已经存在,是否保留
            prefix    “”    在UUID前拼接的字符串前缀

6.Morphline  Interceptor

7.Search and Replace Interceptor
        这个拦截器提供了简单的基于字符串的正则搜索和替换功能。

属性说明:
            type    –    类型名称,必须是"search_replace"
            searchPattern    –    要搜索和替换的正则表达式
            replaceString    –    要替换为的字符串
            charset    UTF-8    字符集编码,默认utf-8

8.Regex Filtering Interceptor
        此拦截器通过解析事件体去匹配给定正则表达式来筛选事件。
        所提供的正则表达式即可以用来包含或刨除事件。

属性说明:
        !type    –    类型,必须设定为regex_filter
        regex    ”.*” 所要匹配的正则表达式
        excludeEvents    false    如果是true则刨除匹配的事件,false则包含匹配的事件。

9.Regex Extractor Interceptor
        使用指定正则表达式匹配事件,并将匹配到的组作为头加入到事件中。
        它也支持插件化的序列化器用来格式化匹配到的组在加入他们作为头之前。

属性说明:
            !type    –    类型,必须是regex_extractor
            !regex    –    要匹配的正则表达式
            !serializers    –    Space-separated list of serializers for mapping matches to header names and serializing their values. (See example below) Flume provides built-in support for the following serializers: org.apache.flume.interceptor.RegexExtractorInterceptorPassThroughSerializer org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer
            serializers.<s1>.type    default    Must be default (org.apache.flume.interceptor.RegexExtractorInterceptorPassThroughSerializer), org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer, or the FQCN of a custom class that implements org.apache.flume.interceptor.RegexExtractorInterceptorSerializer
            serializers.<s1>.name    –    
            serializers.*    –    Serializer-specific properties

----
        If the Flume event body contained 1:2:3.4foobar5 and the following configuration was used

a1.sources.r1.interceptors.i1.regex = (\\d):(\\d):(\\d)
        a1.sources.r1.interceptors.i1.serializers = s1 s2 s3
        a1.sources.r1.interceptors.i1.serializers.s1.name = one
        a1.sources.r1.interceptors.i1.serializers.s2.name = two
        a1.sources.r1.interceptors.i1.serializers.s3.name = three

The extracted event will contain the same body but the following headers will have been added one=>1, two=>2, three=>3
        ----
        
10.channel
    !!!1.Memory Channel 内存通道
        事件将被存储在内存中的具有指定大小的队列中。
        非常适合那些需要高吞吐量但是失败是会丢失数据的场景下。

属性说明:
            !type    –    类型,必须是“memory”
            capacity    100    事件存储在信道中的最大数量
            transactionCapacity    100    每个事务中的最大事件数
            keep-alive    3    添加或删除操作的超时时间
            byteCapacityBufferPercentage    20    Defines the percent of buffer between byteCapacity and the estimated total size of all events in the channel, to account for data in headers. See below.
            byteCapacity    see description    Maximum total bytes of memory allowed as a sum of all events in this channel. The implementation only counts the Event body, which is the reason for providing the byteCapacityBufferPercentage configuration parameter as well. Defaults to a computed value equal to 80% of the maximum memory available to the JVM (i.e. 80% of the -Xmx value passed on the command line). Note that if you have multiple memory channels on a single JVM, and they happen to hold the same physical events (i.e. if you are using a replicating channel selector from a single source) then those event sizes may be double-counted for channel byteCapacity purposes. Setting this value to 0 will cause this value to fall back to a hard internal limit of about 200 GB.

案例:参看入门案例
    2.JDBC Channel
        事件被持久存储在可靠的数据库中。目前支持嵌入式的Derby数据库。如果可恢复性非常的重要可以使用这种方式。

!!!3.File Channel
        性能会比较低下,但是即使程序出错数据不会丢失
        属性说明:
            !type    –    类型,必须是“file”
            checkpointDir    ~/.flume/file-channel/checkpoint    检查点文件存放的位置
            useDualCheckpoints    false    Backup the checkpoint. If this is set to true, backupCheckpointDir must be set
            backupCheckpointDir    –    The directory where the checkpoint is backed up to. This directory must not be the same as the data directories or the checkpoint directory
            dataDirs    ~/.flume/file-channel/data    逗号分隔的目录列表,用以存放日志文件。使用单独的磁盘上的多个目录可以提高文件通道效率。
            transactionCapacity    10000    The maximum size of transaction supported by the channel
            checkpointInterval    30000    Amount of time (in millis) between checkpoints
            maxFileSize    2146435071    一个日志文件的最大尺寸
            minimumRequiredSpace    524288000    Minimum Required free space (in bytes). To avoid data corruption, File Channel stops accepting take/put requests when free space drops below this value
            capacity    1000000    Maximum capacity of the channel
            keep-alive    3    Amount of time (in sec) to wait for a put operation
            use-log-replay-v1    false    Expert: Use old replay logic
            use-fast-replay    false    Expert: Replay without using queue
            checkpointOnClose    true    Controls if a checkpoint is created when the channel is closed. Creating a checkpoint on close speeds up subsequent startup of the file channel by avoiding replay.
            encryption.activeKey    –    Key name used to encrypt new data
            encryption.cipherProvider    –    Cipher provider type, supported types: AESCTRNOPADDING
            encryption.keyProvider    –    Key provider type, supported types: JCEKSFILE
            encryption.keyProvider.keyStoreFile    –    Path to the keystore file
            encrpytion.keyProvider.keyStorePasswordFile    –    Path to the keystore password file
            encryption.keyProvider.keys    –    List of all keys (e.g. history of the activeKey setting)
            encyption.keyProvider.keys.*.passwordFile    –    Path to the optional key password file
    !!!4.Spillable Memory Channel -- 内存溢出通道
        事件被存储在内存队列和磁盘中。
        内存队列作为主存储,而磁盘作为溢出内容的存储。
        内存存储通过embedded File channel来进行管理。
        当内存队列已满时,后续的事件将被存储在文件通道中。
        这个通道适用于正常操作期间适用内存通道已期实现高效吞吐,而在高峰期间适用文件通道实现高耐受性。通过降低吞吐效率提高系统可耐受性。
        如果Agent崩溃,则只有存储在文件系统中的事件可以被恢复。
        此通道处于试验阶段,不建议在生产环境中使用。

属性说明:
        !type    –    类型,必须是"SPILLABLEMEMORY"
        memoryCapacity    10000    内存中存储事件的最大值,如果想要禁用内存缓冲区将此值设置为0。
        overflowCapacity    100000000    可以存储在磁盘中的事件数量最大值。设置为0可以禁用磁盘存储。
        overflowTimeout    3    The number of seconds to wait before enabling disk overflow when memory fills up.
        byteCapacityBufferPercentage    20    Defines the percent of buffer between byteCapacity and the estimated total size of all events in the channel, to account for data in headers. See below.
        byteCapacity    see description    Maximum bytes of memory allowed as a sum of all events in the memory queue. The implementation only counts the Event body, which is the reason for providing the byteCapacityBufferPercentage configuration parameter as well. Defaults to a computed value equal to 80% of the maximum memory available to the JVM (i.e. 80% of the -Xmx value passed on the command line). Note that if you have multiple memory channels on a single JVM, and they happen to hold the same physical events (i.e. if you are using a replicating channel selector from a single source) then those event sizes may be double-counted for channel byteCapacity purposes. Setting this value to 0 will cause this value to fall back to a hard internal limit of about 200 GB.
        avgEventSize    500    Estimated average size of events, in bytes, going into the channel
        <file channel properties>    see file channel    Any file channel property with the exception of ‘keep-alive’ and ‘capacity’ can be used. The keep-alive of file channel is managed by Spillable Memory Channel. Use ‘overflowCapacity’ to set the File channel’s capacity.

5.自定义通道
        自定义渠道需要自己实现Channel接口。
        自定义Channle类及其依赖类必须在Flume启动前放置到类加载的目录下。

参数说明:
            type - 自己实现的Channle类的全路径名称

Flume入门——Selector、Chanel等的更多相关文章

  1. Apache Flume入门指南[翻译自官方文档]

    声明: 根据官方文档选择性的翻译了下,不对请指正 https://flume.apache.org/FlumeUserGuide.html

  2. 大数据学习day35----flume01-------1 agent(关于agent的一些问题),2 event,3 有关agent和event的一些问题,4 transaction(事务控制机制),5 flume安装 6.Flume入门案例

    具体见文档,以下只是简单笔记(内容不全) 1.agent Flume中最核心的角色是agent,flume采集系统就是由一个个agent连接起来所形成的一个或简单或复杂的数据传输通道.对于每一个Age ...

  3. Flume 入门--几种不同的Sources

    1.flume概念 flume是分布式的,可靠的,高可用的,用于对不同来源的大量的日志数据进行有效收集.聚集和移动,并以集中式的数据存储的系统. flume目前是apache的一个顶级项目. flum ...

  4. Flume Channel Selector

    Flume 基于Channel Selector可以实现扇入.扇出. 同一个数据源分发到不同的目的,如下图. 在source上可以定义channel selector: 1 2 3 4 5 6 7 8 ...

  5. 《OD大数据实战》Flume入门实例

    一.netcat source + memory channel + logger sink 1. 修改配置 1)修改$FLUME_HOME/conf下的flume-env.sh文件,修改内容如下 e ...

  6. 大数据入门第十二天——flume入门

    一.概述 1.什么是flume 官网的介绍:http://flume.apache.org/ Flume is a distributed, reliable, and available servi ...

  7. Flume入门

    1.Flume是什么? ○ Flume是由cloudera开发的实时日志收集系统    ○ 核心概念是由一个叫做Agent(代理节点)的java进程运行在日志收集节点    ○ Flume在0.94. ...

  8. Flume入门:安装、部署

    一.什么是Flume? flume 作为 cloudera 开发的实时日志收集系统,受到了业界的认可与广泛应用.Flume 初始的发行版本目前被统称为 Flume OG(original genera ...

  9. Flume 入门--几种不同的Sinks

    主要介绍几种常见Flume的Sink--汇聚点 1.Logger Sink 记录INFO级别的日志,一般用于调试.前面介绍Source时候用到的Sink都是这个类型的Sink 必须配置的属性: 属性说 ...

随机推荐

  1. “Hello world!”团队—选题展示

    本次选题展示内容: 一.视频展示 链接:http://v.youku.com/v_show/id_XMzA5Mzk5NjYwOA==.html?sharefrom=iphone 视频截图链接:http ...

  2. JavaScript初探系列之基本概念

    JavaScript的核心语言特性在ECMA-262中是以名为ECMAScript(ECMA, EuropeanComputer Manufacturers Association )的伪语言的形式来 ...

  3. laravel开发环境部署遇到的问题和个人感受

    >感受 用chrome浏览器 英语很重要 跟上更新的步伐 要不断学习 问问题要把问题描述清楚,先尝试解决,解决不了再问大佬 情绪要稳定,不能因为一个问题困扰两天就想放弃了 发现了 stack o ...

  4. LintCode-376.二叉树的路径和

    二叉树的路径和 给定一个二叉树,找出所有路径中各节点相加总和等于给定 目标值 的路径. 一个有效的路径,指的是从根节点到叶节点的路径. 样例 给定一个二叉树,和 目标值 = 5: 返回: [      ...

  5. iOS-【UIDynamic-UIKit动力学】

    如果看不到图片 可以尝试更换浏览器(推荐Safari ) 0.了解 •Dynamic Animator:动画者,为动力学元素提供物理学相关的能力及动画,同时为这些元素提供相关的上下文,是动力学元素与底 ...

  6. winform Form窗体和UserControl用户空间嵌入Panel容器并填充

    private void sbtbflList_Click(object sender, EventArgs e) { ucxmflList ucfl = new ucxmflList();//用户控 ...

  7. MenuStrip的自动显示

    /// <summary> /// 主界面接受F11时,显示菜单 /// 通过改写Form的ProcessCmdKey实现 /// </summary> /// <par ...

  8. tracert的应用

    tracert IP //检查网络各个节点路由情况: 如果是在10个路有点之内访问到了该站点,说明访问速度良好,若是在10~15之间,说明站点访问状况就一般了. ipconfig /flushdns ...

  9. SQL SERVER技术内幕之4 子查询

    最外层查询的结果集会返回给调用者,称为外部查询.内部查询的结果是供外部查询使用的,也称为子查询.子查询可以分成独立子查询和相关子查询两类.独立子查询不依赖于它所属的外部查询,而相关子查询则须依赖它所属 ...

  10. Delphi Code Editor 之 快捷菜单

    Code Editor的快捷菜单分为两个部分:编辑器菜单项和调试器菜单项. 调试器菜单项留作以后讲解调试应用程序时再讲,这里只讲讲Code Editor的编辑器快捷菜单项. 下面列出了全部菜单项及描述 ...