男女做a视频网站,营销渠道管理,温州文成网站建设,做公益网站CentOS安装Flume 一、简介二、安装1、下载2、解压3、创建配置文件4、启动flume agent5、验证 一、简介 Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log data. It has a simple and flexi… CentOS安装Flume 一、简介二、安装1、下载2、解压3、创建配置文件4、启动flume agent5、验证 一、简介 Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log data. It has a simple and flexible architecture based on streaming data flows. It is robust and fault tolerant with tunable reliability mechanisms and many failover and recovery mechanisms. It uses a simple extensible data model that allows for online analytic application. Flume是一种分布式、高可靠且高可用的服务用于高效地收集、聚合和转移不同来源的大量日志数据。Event是Flume定义的一个数据流传输的最小单元。Agent是一个Flume的实例本质是一个JVM进程该JVM进程控制Event从外部日志生产者那里将数据传输到目的地或者下一个Agent。 一个完整的Agent中包含了必须的三个组件Source、Channel和SinkSource是指数据源的获取方式Channel是一个数据的缓冲池Sink定义了数据输出的方式和目的地这三个组件是必须有的另外还有很多可选的组件interceptor、channel selector、sink processor等。完整流程可以参考下图 Flume也可以设置多级Agent连接的方式传输Event数据完整流程可以参考下图
源码地址
官网地址
中文说明文档可参考这里
源码地址
二、安装
1、下载
本次使用版本V1.11.0 apache-flume-1.11.0-bin.tar.gz
2、解压
tar -zxvf apache-flume-1.11.0-bin.tar.gz3、创建配置文件
本次目标将指定的log文件数据读取出来同步到hdfs中创建配置文件file2hdfs.conf具体配置如下
a1.sourcesr1
a1.sinksk1
a1.channelsc1a1.sources.r1.typetaildir
a1.sources.r1.filegroupsf1
a1.sources.r1.filegroups.f1/wz_program/flume1.11.0/data/111.log
a1.sources.r1.positionFile/wz_program/flume1.11.0/data/taildir.json
a1.sources.r1.fileHeadertruea1.sinks.k1.typehdfs
a1.sinks.k1.hdfs.pathhdfs://hadoop001:8020/tmp/flume3
a1.sinks.k1.hdfs.rollSize1048576
a1.sinks.k1.hdfs.rollInterval0
a1.sinks.k1.hdfs.rollCount0
a1.sinks.k1.hdfs.useLocalTimeStamptrue
a1.sinks.k1.hdfs.writeFormatText
a1.sinks.k1.hdfs.minBlockReplicas1
a1.sinks.k1.hdfs.fileTypeDataStreama1.channels.c1.typememory
a1.channels.c1.capacity100
a1.channels.c1.transactionCapacity100a1.sources.r1.channelsc1
a1.sinks.k1.channelc1
配置说明如下
如上配置文件指定了一个名为a1的Agent其中a1的source为r1sink为k1channel为c1。r1的类型为taildir该类型的source监控指定的一些文件并在检测到新的一行数据产生的时候几乎实时地读取它们。c1类型为memory该类型的channel是把 Event 队列存储到内存上队列的最大数量就是 capacity 的设定值。k1的类型为hdfs该类型的sink是将Event写入Hadoop分布式文件系统。
Taildir Source说明 Memory Channel说明如下 HDFS Sink说明如下
4、启动flume agent
进入到flume的解压目录下执行如下命令注意更换配置文件的路径
./bin/flume-ng agent --conf ./conf --conf-file ../file2hdfs.conf --name a1 解压目录下可查询flume运行的日志记录 启动命令说明如下
--name 后面的名称需要配置为自己的agent名称也就是自己--conf-file文件中配置的第一个单词我的配置为a15、验证
不断向111.log文件中写入内容进入到hdfs中查看log文件是否已同步到指定的路径中