rh007 发表于 2015-9-17 08:10:36

Flume Channel Selector

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

  同一个数据源分发到不同的目的,如下图。
http://www.cnblogs.com/lishouguang/p/d6a019e0-6a7a-4a74-960d-4609e9fb0282_files/9a38805c-1c3e-48b3-817c-b28f261f53b8.png



  在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
  

  

  

  



来自为知笔记(Wiz)
页: [1]
查看完整版本: Flume Channel Selector