HTTP Source用于监听和接收HTTP请求,但是需要注意的是,该Source只能监听GET请求和POST请求。其中,官网指出,GET请求的监听最好只用于实验环境,所以实际生产环境中只用这个Source来监听POST请求。
编辑配置文件
vim httpsource.conf
a1.sources= s1
a1.sinks= k1
a1.channels= c1
// 配置sources
a1.sources.s1.type = seq
a1.sources.s1.channels = c1
a1.sources.s1.totalEvents = 10
// 配置sinks
a1.sinks.k1.type= logger
a1.sinks.k1.channel= c1
// 配置channel
a1.channels.c1.type= memory
启动flume
flume-ng agent -c $FLUME_HOME/conf -n a1 -f $FLUME_HOME/httpsource.conf -Dflume.root.logger=INFO,console
发送http数据
curl -X POST -d '[{"headers":{"kind":"test"},"body":"testing"}]' http://m1:6666
结果