flume中3大高级组件
Flume Interceptors:拦截器,与Spring中拦截器是类似
功能:通过拦截器对每条数据进行过滤护着包装
Timestamp Interceptor:时间拦截器
在每一个event的头部添加一个KeyValue
key: timestamp
value:当前封装event的时间
# The configuration file needs to define the sources,
# the channels and the sinks.
# Sources, channels and sinks are defined per a1,
# in this case called 'a1'
a1.sources = s1
a1.channels = c1
a1.sinks = k1
# defined sources
#如果是自己编译的类,这里写类的全路径
a1.sources.s1.type=exec
a1.sources.s1.command= tail -F /opt/datas/wordcount
a1.sources.s1.shell=/bin/sh -c
a1.sources.s1.interceptors=i1
a1.sources.s1.interceptors.i1.type=timestamp
#define channel
a1.channels.c1.type=memory
#设置检查点, 记录相关传输的信息,比如取了多少event
#容量
a1.channels.c1.capacity=1000
#瓶口大小
a1.channels.c1.transactionCapacity=100
#defined sinks
a1.sinks.k1.type=logger
#bond
a1.sources.s1.channels = c1
a1.sinks.k1.channel = c1
Host Interceptor:主机名拦截器
在每一个event的头部添加一个KeyValue
key: host
value:当前封装event所在机器的主机名
# The configuration file needs to define the sources,
# the channels and the sinks.
# Sources, channels and sinks are defined per a1,
# in this case called 'a1'
a1.sources = s1
a1.channels = c1
a1.sinks = k1
# defined sources
#如果是自己编译的类,这里写类的全路径
a1.sources.s1.type=exec
a1.sources.s1.command= tail -F /opt/datas/wordcount
a1.sources.s1.shell=/bin/sh -c
a1.sources.s1.interceptors=i1
a1.sources.s1.interceptors.i1.type = host
a1.sources.s1.interceptors.i1.hostHeader = hostname
#define channel
a1.channels.c1.type=memory
#设置检查点, 记录相关传输