Flume————flume的高级组件

Flume Interceptors:拦截器
  功能:通过拦截器对每条数据进行过滤和包装

  Timestamp Interceptor:时间戳拦截器
    -》在每一个event的头部添加一个keyvalue
       key:timestamp
       value:当前封装event的时间

  Host Interceptor:主机名拦截器
    -》在每一个event的头部添加一个keyvalue
       key:host
       value:该event所在机器的主机名

  Static Interceptor:用户自定义keyvalue

  Regex Filtering Interceptor    :通过自定义的正则表达式,实现对数据的过滤
符合该正则数据,将会被封装到event中并采集

Flume Channel Selectors:channel选择器
  Replicating Channel Selector (default):
    source将每条数据发给每一个channel
    selector.type=replicating

  Multiplexing Channel Selector
    选择性将数据发给不同的channel
 

selector.type=multiplexing		
a1.sources = s1
a1.channels = c1 c2 c3 c4
a1.sources.s1.selector.type = multiplexing
a1.sources.s1.selector.header = state
a1.sources.s1.selector.mapping.CZ = c1
a1.sources.s1.selector.mapping.US = c2 c3
a1.sources.s1.selector.default = c4

event头信息中取出key是“state”的值,
    如果值是"CZ",该event该c1
    如果值是"us",该event该c2和c3
    否则给c4

a1.sources = s1
a1.channels = c1 c2 c3 c4
a1.sources.s1.selector.type = multiplexing
a1.sources.s1.selector.header = host
a1.sources.s1.selector.mapping.hpsk01 = c1
a1.sources.s1.selector.mapping.hpsk02 = c2 c3
a1.sources.s1.selector.default = c4

Flume Sink Processors(sink的处理器)
  processor.type=default / failover(故障转移) / load_balance(负载均衡)
  一个进程里面有多少个线程,其中一个sink线程,负责将channel数据取出,
 往HDFS上写,如果该线程死掉怎么办????
  如果HDFS宕机怎么办???
    -》负载均衡
    processor.type=load_balance
    processor.selector=random(随机)/round_robin(轮询)
    -》故障转移failover

  processor.type=failover    启动多个,只有一个在工作,在active状态死掉,其他的才能接替他工作
  一般情况下,故障转移2个sink类型不一样(HDFS sink,file sink)
  比如往HDFS写数据的时候,HDFS死掉了,数据不能丢失,这时候可以往文件里写负载均衡和故障转移,只能实现一个,不能同时实现,
  一般来讲都是负载均衡
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值