博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
flume的安装和部署
阅读量:6866 次
发布时间:2019-06-26

本文共 2744 字,大约阅读时间需要 9 分钟。

hot3.png

下载安装包并解压

cd /usr/local wget http://archive.cloudera.com/cdh5/cdh/5/flume-ng-1.6.0-cdh5.7.1.tar.gz tar -xvf flume-ng-1.6.0-cdh5.7.1.tar.gz rm flume-ng-1.6.0-cdh5.7.1.tar.gz mv apache-flume-1.6.0-cdh5.7.1   flume-1.6.0-cdh5.7.1

配置环境变量

cd /usr/local vim .bash_profile export FLUME_HOME=/usr/local/flume-1.6.0-cdh5.7.1 export PATH=$PATH:$FLUME_HOME/bin source .bash_profile

配置flume-env.sh文件

cd  flume-1.6.0-cdh5.7.1/conf/ cp flume-env.sh.template flume-env.sh vim flume-env.shexport JAVA_HOME=/usr/local/jdk1.7.0_79

版本验证

flume-ng version

部署

flume最主要的是sink,sources,和

cd /usr/local/flume-1.6.0-cdh5.7.1/conf/vim test.confagent1的组件名称agent1.sources = source1agent1.sinks = sink1agent1.channels = channel1# 指定Flume source(要监听的路径)#(taildir source ---------windows 暂不支持这种source)agent1.sources.source1.type = taildiragent1.sources.source1.positionFile = /flume/account/taildir_position.jsonagent1.sources.source1.filegroups  = f1agent1.sources.source1.filegroups.f1  =/root/btc/logs/account/dcp/multiple.logagent1.sources.source1.headers.f1.headerKey1  = value1agent1.sources.source1.fileHeader  = trueagent1.sources.source1.type#(exec source ---------)#agent1.sources.source1.type = exec#agent1.sources.source1.command = tail -F /var/log/secure# 指定Flume sinkagent1.sinks.sink1.type = org.apache.flume.sink.kafka.KafkaSinkagent1.sinks.sink1.topic = test#如果kafka是集群,只需要有逗号分隔agent1.sinks.sink1.brokerList = 192.168.80.110:9092agent1.sinks.sink1.requiredAcks = 1agent1.sinks.sink1.batchSize = 100#自定义sink(写东西进数据库)agent1.sinks.mysqlSink.type =com.us.flume.MySinkagent1.sinks.mysqlSink.hostname=localhostagent1.sinks.mysqlSink.port=3306agent1.sinks.mysqlSink.databaseName=sinktestagent1.sinks.mysqlSink.tableName=testagent1.sinks.mysqlSink.user=rootagent1.sinks.mysqlSink.password=xxxxxx# 指定Flume channel内存channelagent1.channels.channel1.type = memoryagent1.channels.channel1.capacity = 1000agent1.channels.channel1.transactionCapacity = 100# 持久化channel,文件channel#agent1.channels.file_channel.type = file#agent1.channels.file_channel.checkpointDir = /var/log/flume-ng/checkpoint#agent1.channels.file_channel.dataDirs = /var/log/flume-ng/data# 绑定source和sink到channel上agent1.sources.source1.channels = channel1agent1.sinks.sink1.channel = channel1

启动flume命令

#-c 是flume 安装目录下的conf

#-f 是配置文件的绝对路径,可以不在flume的安装目录下

#-n 是配置文件中的agent1 ,只是一个名称

#-Dflume.root.logger=INFO,console是log类型,这里是控制台输出

flume-ng agent -c /usr/local/flume-1.6.0-cdh5.7.1/conf  -f  /usr/local/flume-1.6.0-cdh5.7.1/conf/test.conf  -n agent1 -Dflume.root.logger=INFO,consoleflume-ng.cmd agent -conf ../conf -conf  -file ../conf/mysqlSink.conf   -name agent1  -property flume.root.logger=INFO,console

flume 更详细的东西可以查看文档,里面有很多种sink,source.我这里只是列举了我所使用的两种

转载于:https://my.oschina.net/ToFlySeif/blog/1798799

你可能感兴趣的文章
[Android] Android5.1系统自带的应用启动次数统计
查看>>
C#中生成的随机数为什么不随机?
查看>>
Linux I2C(一)之常用的几种实例化(i2c_client ) 【转】
查看>>
windows下一个,OracleServiceXXX和Oracle 关系实例
查看>>
Eclipse上传代码到GitHub
查看>>
字符串中最长不重合子串长度
查看>>
POSIX 可移植操作系统接口
查看>>
jquery+Datatables出现数据过长,表格不自动换行,columns设置width失效的办法
查看>>
MSP430学习笔记9-PS2键盘解码
查看>>
(原创)攻击方式学习之(4) - 拒绝服务(DOS/DDOS/DRDOS)
查看>>
Ubuntu修改mysql的编码集
查看>>
用原始方法解析复杂字符串,json一定要用JsonMapper么?
查看>>
数据库与数据仓库的区别(转载)
查看>>
Java关键字final、static使用总结<转>
查看>>
Excel VBA 宏,使用某模版新建文档时,某些cell自动填充
查看>>
Python天天美味(17) - open读写文件
查看>>
Web应用安全之Response Header里的敏感信息
查看>>
[51单片机] 四相五线减速比为1/64步进电机驱动设计
查看>>
使用HttpHanlder处理404: File not found
查看>>
矩形旋转一定角度后,四个点的新坐标
查看>>