设为首页 收藏本站
查看: 784|回复: 0

[经验分享] flume ng arc and configuration

[复制链接]

尚未签到

发表于 2017-5-21 13:20:01 | 显示全部楼层 |阅读模式
Please ref flume user guide first
http://flume.apache.org/FlumeUserGuide.html
And the Cloudera flume blogs
http://blog.cloudera.com/blog/category/flume/
 
How to define JAVA_HOME, java options and add our customized lib into flume-ng.
All these information will be defined in FLUME_CONFI_DIR/flume-env.sh
Example like below.
JAVA_HOME=/opt/java 
JAVA_OPTS="-Xms200m -Xmx200m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=3669 -Dflume.called.from.service" 
FLUME_CLASSPATH=/opt/sponge/flume/lib/*
 
How start flume-ng as agent
Please note we should name the flume collector name to hostname_agent and this name will be used in the flume-conf-agent.properties
$/usr/lib/flume/bin/flume-ng agent --conf /opt/sponge/flume/config/   --conf-file /opt/sponge/flume/conf/flume-conf-agent.properties  --name hostname_agent &
 
How to start flume-en as collector
Please note we should name the flume collector name to hostname_collector and this name will be used in the flume-conf-collector.properties
     $/usr/lib/flume/bin/flume-ng agent --conf /opt/sponge/flume/config/   --conf-file /opt/sponge/flume/conf/flume-conf-collector.properties  --name hostname_collector &
 
How to define the flume agent and flume collector property file.
I’ve already committed 2 different property files to https://svn.nam.nsroot.net:9050/svn/153299/elf/sponge-branches/2013-03-14-FlumeNG/sponge/myflumeng/config
Please ref flume-conf-agent.properties and flume-conf-collector.properties.
The basic name convention are
1)each agent name will be set as hostname_agent
2)each collector name will be set as hostname_collector
3)the source names will be source1, source2,source3…..
4)the sink name will be avroSink1, avroSink2, avroSink3….
5)each sink’s interceptor will be set as interceptor1, interceptor2, interceptor3 ….
6)all agent sinks will be AVRO sink.
7)the default collector source is AVRO source
8)agent sinks are load balanced as round robin
9)file channel is default for both agent and collector
 
flume-conf-agent.properties
hostname_agent.sources = source1, source2
hostname_agent.channels = fileChannel
hostname_agent.sinks = avroSink1, avroSink2
 
# For each one of the sources, the type is defined
hostname_agent.sources.source1.type = exec
hostname_agent.sources.source1.command = tail -F /var/log/audit/audit.log
hostname_agent.sources.source1.channels = fileChannel
hostname_agent.sources.source1.batchSize=10
 
hostname_agent.sources.source2.type = exec
hostname_agent.sources.source2.command = tail -F /var/log/flume/flume.log
hostname_agent.sources.source2.channels = fileChannel
hostname_agent.sources.source2.batchSize=10
 
# For each one of the sources, the log interceptor is defined
hostname_agent.sources.source1.interceptors = logIntercept1
hostname_agent.sources.source1.interceptors.logIntercept1.type = com.citi.sponge.flume.sink.LogInterceptor$Builder
hostname_agent.sources.source1.interceptors.logIntercept1.preserveExisting = false
hostname_agent.sources.source1.interceptors.logIntercept1.hostName = hostname
hostname_agent.sources.source1.interceptors.logIntercept1.env = PROD
hostname_agent.sources.source1.interceptors.logIntercept1.logType = AUDIT_LOG
hostname_agent.sources.source1.interceptors.logIntercept1.appId = 111111
hostname_agent.sources.source1.interceptors.logIntercept1.logFilePath = /var/log/audit
hostname_agent.sources.source1.interceptors.logIntercept1.logFileName = audit.log
  
hostname_agent.sources.source2.interceptors = logIntercept2
hostname_agent.sources.source2.interceptors.logIntercept2.type = com.citi.sponge.flume.sink.LogInterceptor$Builder
hostname_agent.sources.source2.interceptors.logIntercept2.preserveExisting = false
hostname_agent.sources.source2.interceptors.logIntercept2.hostName = hostname
hostname_agent.sources.source2.interceptors.logIntercept2.env = PROD
hostname_agent.sources.source2.interceptors.logIntercept2.logType = FLUME
hostname_agent.sources.source2.interceptors.logIntercept2.appId = 111111
hostname_agent.sources.source2.interceptors.logIntercept2.logFilePath = /var/log/flume
hostname_agent.sources.source2.interceptors.logIntercept2.logFileName = flume.log
 
 
#for each of the sink, type is defined
hostname_agent.sinks.avroSink1.type = avro
hostname_agent.sinks.avroSink1.hostname=collector1
hostname_agent.sinks.avroSink1.port=1442
hostname_agent.sinks.avroSink1.batchSize=10 
hostname_agent.sinks.avroSink1.channel = fileChannel 
 
hostname_agent.sinks.avroSink2.type = avro
hostname_agent.sinks.avroSink2.hostname=collector2
hostname_agent.sinks.avroSink2.port=1442
hostname_agent.sinks.avroSink2.batchSize=10 
hostname_agent.sinks.avroSink2.channel = fileChannel 
 
 
#Specify the load balance configurations for sinks
agent.sinkgroups = sinkGroup
agent.sinkgroups.sinkGroup.sinks = avroSink1 avroSink2
agent.sinkgroups.sinkGroup.processor.type = load_balance
agent.sinkgroups.sinkGroup.processor.backoff = true
agent.sinkgroups.sinkGroup.processor.selector = round_robin
agent.sinkgroups.sinkGroup.processor.selector.maxBackoffMillis=30000
 
 
# Each channel's type is defined.
hostname_agent.channels.fileChannel.type = file
hostname_agent.channels.fileChannel.checkpointDir = /opt/sponge/file-channel/checkpoint
hostname_agent.channels.fileChannel.dataDirs = /opt/sponge/file-channel/dataDirs
hostname_agent.channels.fileChannel.transactionCapacity = 1000
hostname_agent.channels.fileChannel.checkpointInterval = 30000
hostname_agent.channels.fileChannel.maxFileSize = 2146435071
hostname_agent.channels.fileChannel.minimumRequiredSpace = 524288000
hostname_agent.channels.fileChannel.keep-alive = 5
hostname_agent.channels.fileChannel.write-timeout = 5
hostname_agent.channels.fileChannel.checkpoint-timeout = 600
 
flume-collector.properties
hostname_collector.sources = source
hostname_collector.channels = fileChannel
hostname_collector.sinks = hbaseSink
 
 
# For each one of the sources, the type is defined
hostname_collector.sources.avroSource.channels = fileChannel
hostname_collector.sources.avroSource.type = avro
hostname_collector.sources.avroSource.bind = hostname
hostname_collector.sources.avroSource.port = 1442 
 
hostname_collector.sinks.hbaseSink.type=org.apache.flume.sink.hbase.HBaseSink
hostname_collector.sinks.hbaseSink.table=spong_flumeng_log2
hostname_collector.sinks.hbaseSink.columnFamily=content
hostname_collector.sinks.hbaseSink.serializer=com.citi.sponge.flume.sink.LogHbaseEventSerializer
hostname_collector.sinks.hbaseSink.timeout=120
hostname_collector.sinks.hbaseSink.column=log
hostname_collector.sinks.hbaseSink.batchSize=2
hostname_collector.sinks.hbaseSink.channel=fileChannel
 
 
# Each channel's type is defined.
hostname_collector.channels.fileChannel.type = file
hostname_collector.channels.fileChannel.checkpointDir = /opt/sponge/file-channel/checkpoint
hostname_collector.channels.fileChannel.dataDirs = /opt/sponge/file-channel/dataDirs
hostname_collector.channels.fileChannel.transactionCapacity = 1000
hostname_collector.channels.fileChannel.checkpointInterval = 30000
hostname_collector.channels.fileChannel.maxFileSize = 2146435071
hostname_collector.channels.fileChannel.minimumRequiredSpace = 524288000
hostname_collector.channels.fileChannel.keep-alive = 5
hostname_collector.channels.fileChannel.write-timeout = 5
hostname_collector.channels.fileChannel.checkpoint-timeout = 600

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-379604-1-1.html 上篇帖子: Flume: hbase sink 下篇帖子: Flume 部署注意一
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表