设为首页 加入收藏

TOP

flume1.7.0新功能taildir日志采集
2018-11-28 17:59:01 】 浏览:21
Tags:flume1.7.0 新功能 taildir 日志 采集
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_39478115/article/details/78884902

第一步:解压缩

[root@service_es3 conf]# tar -zvx -f flume-ng-1.6.0-cdh5.11.0.tar.gz 

第二步:修改conf的env文件

[root@service_es3 software]# cd apache-flume-1.6.0-cdh5.11.0-bin/conf/
[root@service_es3 conf]# cp -a flume-env.sh.template flume-env.sh
export JAVA_HOME=/usr/local/java
export JAVA_OPTS="-Xms256m -Xmx1G -Dcom.sun.management.jmxremote"

第三步:添加flume日志采集配置文件

[root@service_es3 apache-flume-1.6.0-cdh5.11.0-bin]# mkdir appConf 

### define agent
bdpAgent.sources = r3
bdpAgent.channels = c3
bdpAgent.sinks = k3

### define sources
bdpAgent.sources.r3.type = TAILDIR
bdpAgent.sources.r3.spoolDir = /opt/data/gps
bdpAgent.sources.r3.positionFile = /opt/software/flume-1.6.0-cdh5.11.0/source/gps/taildir_position.json
bdpAgent.sources.r3.filegroups = f1
bdpAgent.sources.r3.filegroups.f1 = /opt/data/gps/.*.complete
bdpAgent.sources.r3.headers.f1.headerKey1 = value1
bdpAgent.sources.r3.fileHeader = true

### define channels
bdpAgent.channels.c3.type = file
bdpAgent.channels.c3.checkpointDir = /opt/software/flume-1.6.0-cdh5.11.0/channels/gps/checkpointDir
bdpAgent.channels.c3.dataDirs = /opt/software/flume-1.6.0-cdh5.11.0/channels/gps/dataDir

### define sink
bdpAgent.sinks.k3.type = hdfs
bdpAgent.sinks.k3.hdfs.path = hdfs://10.27.227.160:8020/xqtravel-boss-bd/bufferData/gpsDetail
bdpAgent.sinks.k3.hdfs.fileType = DataStream
bdpAgent.sinks.k3.hdfs.writeFormat = Text
bdpAgent.sinks.k3.hdfs.useLocalTimeStamp = true
bdpAgent.sinks.k3.hdfs.rollInterval = 14400
bdpAgent.sinks.k3.hdfs.rollSize = 0
bdpAgent.sinks.k3.hdfs.rollCount = 0
bdpAgent.sinks.k3.hdfs.idleTimeout = 0
bdpAgent.sinks.k3.hdfs.filePrefix = %Y%m%d_
bdpAgent.sinks.k3.hdfs.fileSuffix = .log

### bind the soures and sink to the channel
bdpAgent.sources.r3.channels = c3
bdpAgent.sinks.k3.channel = c3

第四步:添加flume依赖的jar包

commons-configuration-1.6.jar  
commons-daemon-1.0.13.jar  
hadoop-auth-2.6.0.jar   
hadoop-common-2.6.0-cdh5.11.0.jar  
hadoop-hdfs-2.6.0-cdh5.11.0.jar  
hadoop-hdfs-nfs-2.6.0-cdh5.11.0.jar  
hadoop-mapreduce-client-core-2.6.0-cdh5.11.0.jar  
hadoop-nfs-2.6.0-cdh5.11.0.jar  
htrace-core4-4.0.1-incubating.jar 

第五步:设置flume日志收集主程序

[root@service_es3 apache-flume-1.6.0-cdh5.11.0-bin]# mkdir appPro
[root@es flume-ng-1.6.0-cdh5.11.0]# cd appPro/
#! /bin/bash
nohup ../bin/flume-ng agent -n bdpAgent -c ../conf -f ../appConf/flume-xqtravelbdp-gpsDetail.conf  -Dflume.root.logger=INFO,console > gpsDetailCollector.log &
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇flume+kafka收集业务日志 下一篇Flume:本地文件到Kafka

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目