实时采集(实时流)

Memory Channel(内存Channels)

  • 当前缓冲区最多能够缓冲多少条数据(Event):a1.channels.c1.capacity
  • 数据源一次最多能写多少数据到缓冲区:a1.channels.c1.transactionCapacity

image.png

代码

  1. # example.conf: A single-node Flume configuration
  2. # Name the components on this agent
  3. a1.sources = r1
  4. a1.sinks = k1
  5. a1.channels = c1
  6. # Describe/configure the source
  7. a1.sources.r1.type = exec
  8. a1.sources.r1.command = tail -F /home/hadoop/pikaqiu.txt
  9. # Describe the sink
  10. a1.sinks.k1.type = logger
  11. # Use a channel which buffers events in memory
  12. a1.channels.c1.type = memory
  13. a1.channels.c1.capacity = 1000
  14. a1.channels.c1.transactionCapacity = 100
  15. # Bind the source and sink to the channel
  16. a1.sources.r1.channels = c1
  17. a1.sinks.k1.channel = c1

启动脚本

flume-ng agent --conf conf --conf-file /home/hadoop/kylin/f.conf --name a1
-Dflume.root.logger=INFO,console