[关闭]
@hai046 2016-01-27T10:10:48.000000Z 字数 2295 阅读 1178

flume 初步调研

flume


介绍

满足我们需求有
1,tail 监控日志
2,sdk支持传输输入日志
3,支持直接转换成hdfs
4,thrift数据源
等等

官方网站:http://flume.apache.org/
官方指导:http://flume.apache.org/FlumeUserGuide.html

支持数据源列表

Avro Source
Thrift Source
Exec Source
JMS Source
Converter
Spooling Directory Source
Event Deserializers
LINE
AVRO
BlobDeserializer
Twitter 1% firehose Source (experimental)
Kafka Source
NetCat Source
Sequence Generator Source
Syslog Sources
Syslog TCP Source
Multiport Syslog TCP Source
Syslog UDP Source
HTTP Source
JSONHandler
BlobHandler
Stress Source
Legacy Sources
Avro Legacy Source
Thrift Legacy Source
Custom Source
Scribe Source

测试

在10.10.5.11:/opt/apache-flume 目录下

收集数据

配置

  1. agent1.sources = source1
  2. agent1.sinks = sink1
  3. agent1.channels = channel1
  4. # Describe/configure tail -F source1
  5. agent1.sources.source1.type = exec
  6. agent1.sources.source1.command = tail -F /data/log/jiemo-api/access.log#监控日志
  7. agent1.sources.source1.channels = channel1
  8. agent1.sources.source1.batchSize = 1
  9. #configure host for source
  10. agent1.sources.source1.interceptors = i1
  11. agent1.sources.source1.interceptors.i1.type = host
  12. agent1.sources.source1.interceptors.i1.hostHeader = hostname
  13. # Describe avro sink1
  14. agent1.sinks.sink1.type = avro
  15. agent1.sinks.sink1.hostname = 10.10.5.11
  16. agent1.sinks.sink1.port = 4545
  17. # Use a channel which buffers events in memory
  18. agent1.channels.channel1.type = memory
  19. agent1.channels.channel1.keep-alive = 0
  20. agent1.channels.channel1.capacity = 500000
  21. agent1.channels.channel1.transactionCapacity = 100
  22. # Bind the source and sink to the channel
  23. agent1.sources.source1.channels = channel1
  24. agent1.sinks.sink1.channel = channel1

开启

  1. bin/flume-ng agent -c conf -f conf/jiemo-api.properties -n agent1 -Dflume.root.logger=DEBUG,console

接收方

配置【现在是文件保存】

  1. agent1.sources = source1
  2. agent1.sinks = sink1
  3. agent1.channels = channel1
  4. # Describe/configure avro source
  5. agent1.sources.source1.type = avro
  6. agent1.sources.source1.bind = 0.0.0.0
  7. agent1.sources.source1.port = 4545
  8. # Describe logger sink1
  9. #agent1.sinks.sink1.type = logger
  10. # Describe file sink1
  11. agent1.sinks.sink1.type = file_roll
  12. agent1.sinks.sink1.sink.directory = /var/log/flume #存放数据位置
  13. # Use a channel which buffers events in memory
  14. agent1.channels.channel1.type = memory
  15. agent1.channels.channel1.keep-alive = 1
  16. agent1.channels.channel1.capacity = 5000
  17. agent1.channels.channel1.transactionCapacity = 100
  18. # Bind the source and sink to the channel
  19. agent1.sources.source1.channels = channel1
  20. agent1.sinks.sink1.channel = channel1

开启

  1. bin/flume-ng agent -c conf -f conf/jiemo-api-avro.properties -n agent1 -Dflume.root.logger=DEBUG,console
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注