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. Thunder团队Beta周贡献分规则

    小组名称:Thunder 项目名称:i阅app 组长:王航 成员:李传康.翟宇豪.邹双黛.苗威.宋雨.胡佑蓉.杨梓瑞 分配规则 规则1:基础分,拿出总分的20%(8分)进行均分,剩下的80%(32分) ...

  2. shiro控制登陆成功后跳回之前的页面

    登陆之后跳回之前的页面是在做登陆注册模块时遇到的一个需求,也是很有必要的.若用户直接访问登陆页面,那可以控制它直接到首页,但是要用户没有登陆直接访问自己的购物车等需要经过身份认证的页面,或者因为ses ...

  3. Tomcat服务器学习和使用(一)

    一.Tomcat服务器端口的配置 Tomcat的所有配置都放在conf文件夹之中,里面的server.xml文件是配置的核心文件. 如果想修改Tomcat服务器的启动端口,则可以在server.xml ...

  4. C++并行编程2

    启动线程 查看线程构造函数,接受一个返回值为void的函数.如下: void do_some_work(); std::thread my_thread(do_some_work); 也可以接受一个重 ...

  5. HDU 2117 Just a Numble

    http://acm.hdu.edu.cn/showproblem.php?pid=2117 Problem Description Now give you two integers n m, yo ...

  6. Ubuntu 12.04.1 LTS 升级 PHP 从5.3 到 5.5

    #!/bin/bash # desc install php5.5 #add-apt-repository ppa:ondrej/php5 #apt-get install python-softwa ...

  7. [计算机网络-传输层] 无连接传输:UDP

    UDP(用户数据报协议) 下面是UDP的报文段格式: 可以看出UDP的首部长度是固定的,共64bit,即8个字节. 校验和:提供了差错检测得功能,即用于确定当UDP报文段从源到达目的时,其中的比特是否 ...

  8. Go语言【第三篇】:Go变量和常量

    Go语言变量 变量来源于数学,是计算机语言中能存储计算结果或能表示值抽象概念.变量可以通过变量名访问.Go语言变量名由字母.数字.下划线组成,其中首字母不能为数字,声明变量的一般形式是使用var关键字 ...

  9. react 入门与进阶教程

    react 入门与进阶教程 前端学习对于我们来说越来越不友好,特别是随着这几年的发展,入门门槛越来越高,连进阶道路都变成了一场马拉松.在学习过程中,我们面临很多选择,vue与react便是一个两难的选 ...

  10. [BZOJ2055] 80人环游世世界

    Description ​ 想必大家都看过成龙大哥的<80天环游世界>,里面的紧张刺激的打斗场面一定给你留下了深刻的印象.现在就有这么 ​ 一个80人的团伙,也想来一次环游世界. ​ 他们 ...