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

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

  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









相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2022-01-19
  • 2021-12-30
  • 2021-12-01
  • 2021-11-29
  • 2021-06-07
猜你喜欢
  • 2022-01-09
  • 2021-06-22
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案