Hadoop Flume
基本概念
agent 一个完整的flume程序,它包含了采集(source),缓存(channel),写入(sink)
source 数据的来源
channel 缓存通道,联通source和sink
sink 写入到数据仓库或者下一个agent
安装
然后解压 tar -zxvf apache-flume-1.6.0-bin.tar.gz
然后进入flume的目录,修改conf下的flume-env.sh,在里面配置JAVA_HOME
bin/flume-ng agent -c conf/ -f dir-hdfs.conf -n ag1
扫描文件夹,如果有新文件生成则采集
#定义三大组件的名称
ag1.sources = source1
ag1.sinks = sink1
ag1.channels = channel1# 配置source组件# 读取目录,
ag1.sources.source1.type = spooldir# 设置所读取的目录
ag1.sources.source1.spoolDir = /root/log/# 采集后给文件添加后缀
ag1.sources.source1.fileSuffix=.FINISHED
ag1.sources.source1.deserializer.maxLineLength=5120# 配置sink组件
ag1.sinks.sink1.type = hdfs#每隔round分钟新建一个目录
ag1.sinks.sink1.hdfs.path =hdfs://ip1:9000/access_log/%y-%m-%d/%H-%M# 生成文件的前缀
ag1.sinks.sink1.hdfs.filePrefix = app_log# 生成文件的后缀
ag1.sinks.sink1.hdfs.fileSuffix = .log# 100条写一次hdfs
ag1.sinks.sink1.hdfs.batchSize= 100# 输入什么就输出什么
ag1.sinks.sink1.hdfs.fileType = DataStream#字符串形式
ag1.sinks.sink1.hdfs.writeFormat =Text## roll:滚动切换:控制写文件的切换规则 # 按文件体积(字节)来切
ag1.sinks.sink1.hdfs.rollSize = 512000# 按event条数切
ag1.sinks.sink1.hdfs.rollCount = 1000000# 按时间间隔切换文件
ag1.sinks.sink1.hdfs.rollInterval = 60## 控制生成目录的规则# 切换目录
ag1.sinks.sink1.hdfs.round = true
ag1.sinks.sink1.hdfs.roundValue = 10
ag1.sinks.sink1.hdfs.roundUnit = minuteag1.sinks.sink1.hdfs.useLocalTimeStamp = true# channel组件配置
ag1.channels.channel1.type = memory## event条数
ag1.channels.channel1.capacity = 100000##flume事务控制所需要的缓存容量600条event
ag1.channels.channel1.transactionCapacity = 600# 绑定source、channel和sink之间的连接
ag1.sources.source1.channels = channel1
ag1.sinks.sink1.channel = channel1
扫描文件,如果文件有添加则采集
本质上是读取tail返回的
# 配置source组件# 读取目录,
ag1.sources.source1.type = exec# 设置所读取的目录
ag1.sources.source1.command = tail -F /root/log# 采集后给文件添加后缀
串联
bin/flume-ng agent -c conf -f conf/avro-m-log.conf -n a1 -Dflume.root.logger=INFO,console
bin/flume-ng avro-client -H localhost -p 4141 -F log.10
上一级(客户端)
从tail命令获取数据发送到avro端口
另一个节点可配置一个avro源来中继数据,发送外部存储
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /root/log# Describe the sink
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = hdp-05
a1.sinks.k1.port = 4141
a1.sinks.k1.batch-size = 2# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
下一级(服务端)
从avro端口接收数据,下沉到hdfs采集配置文件,avro-hdfs.conf# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1# Describe/configure the source
##source中的avro组件是一个接收者服务
a1.sources.r1.type = avro
a1.sources.r1.bind = hdp-05
a1.sources.r1.port = 4141# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = /flume/taildata/%y-%m-%d/
a1.sinks.k1.hdfs.filePrefix = tail-
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.roundValue = 24
a1.sinks.k1.hdfs.roundUnit = hour
a1.sinks.k1.hdfs.rollInterval = 0
a1.sinks.k1.hdfs.rollSize = 0
a1.sinks.k1.hdfs.rollCount = 50
a1.sinks.k1.hdfs.batchSize = 10
a1.sinks.k1.hdfs.useLocalTimeStamp = true
#生成的文件类型,默认是Sequencefile,可用DataStream,则为普通文本
a1.sinks.k1.hdfs.fileType = DataStream# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1发送数据:
Hadoop Flume相关推荐
- flume java 安装部署_[Hadoop] Flume安装部署与简单使用
1. Flume Flume是一个分布式的日志收集框架,针对日志数据进行采集汇总,把日志从A地方搬运到B地方去. 使用场景: RDBMS ==> Sqoop ==> Hadoop 分散在各 ...
- 记录完全分布式开发zookeeper hadoop flume kafka hbase
先写坑:练习都是在自己的用户下(非root用户),一定要随时注意自己的目录的权限,用sftp来上传 最终做成的样子 | hadoop101 datanode namenode kafka flume ...
- [置顶] HADOOP大数据离线分析+实时分析框架;Hadoop+Flume+Kafka+Storm+Hive+Sqoop+mysql/oracle
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 离线分析框架搭建 hadoop集群搭建部署 Hadoop HA部署 Hive安装部署 Sqoop组件安装部署 实时分析框架搭建 ...
- HADOOP大数据离线分析+实时分析框架;Hadoop+Flume+Kafka+Storm+Hive+Sqoop+mysql/oracle
离线分析框架搭建 hadoop集群搭建部署 Hadoop HA部署 Hive安装部署 Sqoop组件安装部署 实时分析框架搭建 storm kafka kafka安装配置 storm集群安装部署
- flume java_Flume的安装及简单的使用(一)
1.Flume简介 Flume是Cloudera提供的一个高可用.高可靠.分布式的海量日志采集.聚合和传输的系统.Flume支持在日志系统中定制各类数据发送方用于收集数据,同时Flume提供对数据的简 ...
- flume linux环境搭建,linux安装flume及问题
1.安装 1)下载:wget http://www.apache.org/dyn/closer.lua/flume/1.6.0/apache-flume-1.6.0-bin.tar.gz 解压tar ...
- Flume Sink
一 HDFS Sink 将event写入HDFS. 1.1 RequiredProperties channel:从哪一个channelpull数据 type:hdfs hdfs.path:HDFS ...
- 大数据之-入门_大数据部门组织结构(重点)---大数据之hadoop工作笔记0007
hadoop,flume,kafka,hbase,spark等需要去采集数据,这里分为开发和运维,开发是去搭建这个平台,运维保证他们正常运行 这里最好,把他们的源码都,研究明白.最好还能改改,从新把源 ...
- 2020年11月 工信部考试——Hadoop(数据应用技术)中级认证3
系统提纲 281.掌握常用 hdfs 操作命令,执行并查看结果. 283. 在 Linux 系统中创建一个目录 work,并在该目录下创建文件 file.txt, 写入"I have a d ...
最新文章
- Log4j2异步日志背后的数字
- 为什么大家都只谈薪资,却不谈梦想?
- 计算机跨考英语口译,英语口译学习网_考研复试经验:跨考过来人谈复试感受_沪江英语...
- html2canvas图片坐标,html2canvas生成的图片偏移不完整的解决方法
- JupyterHub on Kubernetes绘图支持软件
- 普通程序员如何向人工智能方向转型?
- [zencart数据采集]第二课 火车头采集简单系统配置
- 《红周刊》独家对话芒格:你可以随自己喜欢一辈子不理性,那必然承受糟糕结果
- android横向滑动分享,Android将ListView逆时针旋转90°实现横向滑动
- 移动网速测试软件,网速测试大师APP
- 在微型计算机所说的80586,2017年职称计算机考试题库及答案
- IMU(陀螺仪)角速度测量原理-科氏力测旋转角速度
- 英语cowbezoar牛黄CowBezoar单词
- 不到两小时教会你用JAVA制作超级玛丽小游戏
- python分词考研英语真题词频(附结果)——读取word、nltk、有道智云API
- Java学习 之 画图板 立方体
- JavaScript简单的数据总计怎么做?
- console用法java_Java Console printf(String, Object)用法及代码示例
- pandas 如何删掉第一行_pandas删除指定行详解
- 信息安全专业毕业设计选题推荐