Flume 基于Channel Selector可以实现扇入、扇出。

同一个数据源分发到不同的目的,如下图。


在source上可以定义channel selector:

1
2
3
4
5
6
7
8
9
a1.sources=r1
...
a1.channels=c1 c2
...
a1.sources.r1.selector.type=multiplexing
a1.sources.r1.selector.header=type
a1.sources.r1.selector.mapping.type1=c1
a1.sources.r1.selector.mapping.type2=c2
...

但是这个type变量从哪里来呢?

解决方法:

1、修改用到的那个source的源码,应用到client端,不同的数据类型添加不同的type

2、在source端配置interceptor,通过interceptor在header上设置变量type

比如:

使用regex_extractor,对传过来的数据进行处理,提取出type值(如果可以的话,可以在client端的数据格式添加type值,方便使用regex_extractor提取出来)。

3、在source端自定义interceptor,在interceptor里对处理变量type

Flume Channel Selector的更多相关文章

  1. Flume Channel Selectors + kafka

    http://flume.apache.org/FlumeUserGuide.html#custom-channel-selector 官方文档上channel selectors 有两种类型: Re ...

  2. Flume入门——Selector、Chanel等

    1.selector (http://blog.csdn.net/looklook5/article/details/40430965) (http://blog.csdn.net/xiao_jun_ ...

  3. Flume Channel Selectors官网剖析(博主推荐)

    不多说,直接上干货! Flume Sources官网剖析(博主推荐) Flume Channels官网剖析(博主推荐) 一切来源于flume官网 http://flume.apache.org/Flu ...

  4. Flume-Replicating Channel Selector 单数据源多出口

    使用 Flume-1 监控文件变动,Flume-1 使用 Replicating Channel Selector 将变动内容传递给 Flume-2,Flume-2 负责存储到 HDFS.同时 Flu ...

  5. Flume配置Replicating Channel Selector

    1 官网内容 上面的配置是r1获取到的内容会同时复制到c1 c2 c3 三个channel里面 2 详细配置信息 # Name the components on this agent a1.sour ...

  6. Flume配置Multiplexing Channel Selector

    1 官网内容 上面配置的是根据不同的heder当中state值走不同的channels,如果是CZ就走c1 如果是US就走c2 c3 其他默认走c4 2 我的详细配置信息 一个监听http端口 然后 ...

  7. NIO的Buffer&Channel&Selector

    java的NIO和AIO Buffer position.limit.capacity 初始化 Buffer 填充 Buffer 提取 Buffer 中的值 mark() & reset() ...

  8. 一段关于java NIO server端接受客户端socket连接;演示了关于channel,selector等组件的整合使用

    public class ReactorDemo { public static void main(String[] args) throws IOException { ServerSocketC ...

  9. Flume Channel

    http://blog.csdn.net/john_f_lau/article/details/20913831 http://dev.cmcm.com/archives/194

随机推荐

  1. LeetCode--No.004 Median of Two Sorted Arrays

    4. Median of Two Sorted Arrays Total Accepted: 104147 Total Submissions: 539044 Difficulty: Hard The ...

  2. hdu 5972---Regular Number(字符串匹配)

    题目链接 Problem Description Using regular expression to define a numeric string is a very common thing. ...

  3. jQuery操作select下拉框的text值和value值的方法

    1.jquery获取当前选中select的text值 $("#select1").find("option:selected").text(); 2.jquer ...

  4. python lxml库生成xml文件-节点命名空间问题

    lxml库,处理xml很强大,官方文档:https://lxml.de/tutorial.html#namespaces 例如: 我们要生成如下格式的报文: <ttt:jesson xmlns: ...

  5. java中String类型与Date日期类型的互相转换

    //String格式的数据转化成Date格式,Date格式转化成String格式 SimpleDateFormat formatter= new SimpleDateFormat("yyyy ...

  6. MySQL笔记(8)---备份与恢复

    1.前言 本章记录数据库的备份与恢复操作.MySQL提供了很多工具完成备份工作:mysqldump.ibbackup.replication,也可以使用一些第三方的工具完成,如xtrabacup.LV ...

  7. IMEI

    IMEI(International Mobile Equipment Identity)是国际移动设备身份码的缩写,国际移动装备辨识码,是由15位数字组成的"电子串号",它与每台 ...

  8. Spring Boot - 修改Tomcat默认的8080端口

    前言 默认情况下,Spring Boot内置的Tomcat服务会使用8080端口启动,我们可以使用以下任何技巧去更改默认的Tomcat端口: 注:我们可以通过server.port=0配置,去自动配置 ...

  9. 比Python、Java更快的 Go 语言,能否称霸江湖?

    关注之后加星标,江湖要事早知道 ​ 文章来源:jb51.net 有一种语言堪称比语言排行榜前五热门选手的Python.Java更快,它就是GO语言. Go于2009年11月正式宣布推出,成为开放源代码 ...

  10. TCP/IP 笔记 - Internet协议

    IP是TCP/IP协议族中的核心协议,TCP.UDP.ICMP.IGMP数据都通过IP数据报传输.IP提供了一种"尽力而为.无连接"的数据交付服务:尽力而为表示不保证IP数据报能成 ...