Flume使用案例之实时读取本地文件到HDFS

楼高2年前技术文章797

Flume实时读取本地文件到HDFS

1.  创建flume-hdfs.conf文件

# 1 agent

a2.sources = r2

a2.sinks = k2

a2.channels = c2

 

# 2 source

a2.sources.r2.type = exec

a2.sources.r2.command = tail -F /opt/Andy

a2.sources.r2.shell = /bin/bash -c

 

# 3 sink

a2.sinks.k2.type = hdfs

a2.sinks.k2.hdfs.path = hdfs://dtstack_hdfs:9000/flume/%Y%m%d/%H

#上传文件的前缀

a2.sinks.k2.hdfs.filePrefix = logs-

#是否按照时间滚动文件夹

a2.sinks.k2.hdfs.round = true

#多少时间单位创建一个新的文件夹

a2.sinks.k2.hdfs.roundValue = 1

#重新定义时间单位

a2.sinks.k2.hdfs.roundUnit = hour

#是否使用本地时间戳

a2.sinks.k2.hdfs.useLocalTimeStamp = true

#积攒多少个EventflushHDFS一次

a2.sinks.k2.hdfs.batchSize = 1000

#设置文件类型,可支持压缩

a2.sinks.k2.hdfs.fileType = DataStream

#多久生成一个新的文件

a2.sinks.k2.hdfs.rollInterval = 600

#设置每个文件的滚动大小

a2.sinks.k2.hdfs.rollSize = 134217700

#文件的滚动与Event数量无关

a2.sinks.k2.hdfs.rollCount = 0

#最小副本数

a2.sinks.k2.hdfs.minBlockReplicas = 1

 

# Use a channel which buffers events in memory

a2.channels.c2.type = memory

a2.channels.c2.capacity = 1000

a2.channels.c2.transactionCapacity = 100

 

# Bind the source and sink to the channel

a2.sources.r2.channels = c2

a2.sinks.k2.channel = c2

2. 执行监控配置

/opt/module/flume1.8.0/bin/flume-ng agent \

--conf /opt/module/flume1.8.0/conf/ \

--name a2 \

--conf-file /opt/module/flume1.8.0/jobconf/flume-hdfs.conf


相关文章

Kubevela源码解读(一):application_controller解读

application_controller是kubevela最主要的一个控制器,作用就是将用户创建的applicaion转化为实际需要创建的资源对象,通过本文可以:1、了解cue模版在kubevel...

MySQL性能优化(一)索引缺失引起的全表扫描

MySQL性能优化(一)索引缺失引起的全表扫描

索引缺失是引起数据库性能问题的第一大原因。一个例子这是一个非常简单的SQL,SELECT * FROM template WHERE templet_id ...

Prometheus 监控 Nginx

Prometheus 监控 Nginx

一、Nginx_exporter安装下载链接:https://github.com/discordianfish/nginx_exporter下载nginx_exporter的docker镜像。doc...

Ambari集群Spark3.x动态资源分配

Ambari集群Spark3.x动态资源分配

环境节点hdp01HDP3.1.5hdp02Spark3.2.4hdp03首先Spark配置History服务配置spark-defaults.confspark.master            ...

em升级&添加节点实践

em升级&添加节点实践

一、扩容前准备 1.格式化磁盘分区并挂载(1)设置gpt分区表          &nbs...

Doris性能测试

Doris性能测试

1.性能测试(1)环境信息硬件环境 软件环境l Doris 部署 3BE 3FE;l 内核版本:Linux version 5.5.0-96-genericl 操作系统版本:CentOS Linux...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。