详细配置文件flume-conf.properties如下:

############################################
# producer config
########################################### #agent section
producer.sources = s
producer.channels = c c1
producer.sinks = r r1 #source section
#producer.sources.s.type = exec
#producer.sources.s.command = tail -f -n+1 /usr/local/test.log producer.sources.s.type = spooldir
producer.sources.s.spoolDir = /usr/local/testlog
producer.sources.s.fileHeader = true
producer.sources.s.batchSize = 100 producer.sources.s.channels = c c1 # Each sink's type must be defined
producer.sinks.r.type = org.apache.flume.plugins.KafkaSink
producer.sinks.r.metadata.broker.list=127.0.0.1:9092
producer.sinks.r.partition.key=0
producer.sinks.r.partitioner.class=org.apache.flume.plugins.SinglePartition
producer.sinks.r.serializer.class=kafka.serializer.StringEncoder
producer.sinks.r.request.required.acks=0
producer.sinks.r.max.message.size=1000000
producer.sinks.r.producer.type=sync
producer.sinks.r.custom.encoding=UTF-8
producer.sinks.r.custom.topic.name=topcar #store in HDFS
producer.sinks.r1.type = hdfs
producer.sinks.r1.channel = c1
producer.sinks.r1.hdfs.path=hdfs://node2:9000/user/flume/events/%Y-%m-%d-%H
producer.sinks.r1.hdfs.filePrefix=events-
#producer.sinks.r1.hdfs.fileSuffix = .log #设定后缀
producer.sinks.r1.hdfs.round = true
producer.sinks.r1.hdfs.roundValue = 10
producer.sinks.r1.hdfs.roundUnit = minute
#--文件格式:默认SequenceFile,可选 DataStream \ CompressedStream
producer.sinks.r1.hdfs.fileType=DataStream
#--Format for sequence file records. “Text” or “Writable”
producer.sinks.r1.hdfs.writeFormat=Text
producer.sinks.r1.hdfs.rollInterval=0
#--触发roll操作的文件大小in bytes (0: never roll based on file size)
producer.sinks.r1.hdfs.rollSize=128000000
#--在roll操作之前写入文件的事件数量(0 = never roll based on number of events)
producer.sinks.r1.hdfs.rollCount=0
producer.sinks.r1.hdfs.idleTimeout=60
#--使用local time来替换转移字符 (而不是使用event header的timestamp)
producer.sinks.r1.hdfs.useLocalTimeStamp = true producer.channels.c1.type = memory
producer.channels.c1.capacity = 1000
producer.channels.c1.transactionCapacity=1000
producer.channels.c1.keep-alive=30 #Specify the channel the sink should use
producer.sinks.r.channel = c # Each channel's type is defined.
producer.channels.c.type = memory
producer.channels.c.capacity = 1000 ############################################
# consumer config
########################################### consumer.sources = s
consumer.channels = c
consumer.sinks = r consumer.sources.s.type = seq
consumer.sources.s.channels = c
consumer.sinks.r.type = logger consumer.sinks.r.channel = c
consumer.channels.c.type = memory
consumer.channels.c.capacity = 100 consumer.sources.s.type = org.apache.flume.plugins.KafkaSource
consumer.sources.s.zookeeper.connect=127.0.0.1:2181
consumer.sources.s.group.id=testGroup
consumer.sources.s.zookeeper.session.timeout.ms=400
consumer.sources.s.zookeeper.sync.time.ms=200
consumer.sources.s.auto.commit.interval.ms=1000
consumer.sources.s.custom.topic.name=topcar
consumer.sources.s.custom.thread.per.consumer=4

Flume启动命令如下:

bin/flume-ng agent --conf conf --conf-file conf/flume-conf.properties --name producer -Dflume.root.logger=INFO,console

FLume监控文件夹,将数据发送给Kafka以及HDFS的配置文件详解的更多相关文章

  1. Python 的 pyinotify 模块 监控文件夹和文件的变动

    官方参考: https://github.com/seb-m/pyinotify/wiki/Events-types https://github.com/seb-m/pyinotify/wiki/I ...

  2. Storm监控文件夹变化 统计文件单词数量

    监控指定文件夹,读取文件(新文件动态读取)里的内容,统计单词的数量. FileSpout.java,监控文件夹,读取新文件内容 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...

  3. 【.Net 学习系列】-- FileSystemWatcher 监控文件夹新生成文件,并在确认文件没有被其他程序占用后将其移动到指定文件夹

    监控文件夹测试程序: using System; using System.Collections.Generic; using System.IO; using System.Linq; using ...

  4. [转帖]Linux下inotify监控文件夹状态,发生变化后触发rsync同步

    Linux下inotify监控文件夹状态,发生变化后触发rsync同步 https://www.cnblogs.com/fjping0606/p/6114123.html 1.安装工具--inotif ...

  5. 1.8-1.10 大数据仓库的数据收集架构及监控日志目录日志数据,实时抽取之hdfs系统上

    一.数据仓库架构 二.flume收集数据存储到hdfs 文档:http://flume.apache.org/releases/content/1.9.0/FlumeUserGuide.html#hd ...

  6. 网卡配置文件详解 用户管理与文件权限篇 文件与目录权限 软连接 tar解压命令 killall命令 linux防火墙 dns解析设置 计划任务crond服务 软件包安装 阿里云 yum源 安装

    Linux系统基础优化及常用命令 Linux基础系统优化 引言没有,只有一张图. Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令. ...

  7. Nagios监控平台搭建及配置文件详解

    Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员, ...

  8. Spring配置文件详解 – applicationContext.xml文件路径

    Spring配置文件详解 – applicationContext.xml文件路径 Java编程                 spring的配置文件applicationContext.xml的默 ...

  9. 如何用R来处理数据表的长宽转换(图文详解)

    不多说,直接上干货! 很多地方都需用到这个知识点,比如Tableau里.   通常可以采取如python 和 r来作为数据处理的前期. Tableau学习系列之Tableau如何通过数据透视表方式读取 ...

随机推荐

  1. XUtils开源框架的使用(HttpUtils支持多线程断点续传)

    XUtils项目下载地址:https://github.com/wyouflf/xUtils XUtils中包含的四大模块: 1.DbUtils模块 2.ViewUtils模块 3.HttpUtils ...

  2. CSS 显示或隐藏子元素

    很多时候我们仅仅只是想让鼠标移动入某个元素,然后显示出某个元素. 大多数博客的标题或内容都是:使用CSS实现鼠标悬停在一行上,显示某些元素 很遗憾,这是错误的,鼠标悬停后,尽管CSS标准中有定义此种方 ...

  3. ThreadLocal和ThreadLocalMap源码分析

    目录 ThreadLocal和ThreadLocalMap源码分析 背景分析 定义 例子 源码分析 ThreadLocalMap源码分析 ThreadLocal源码分析 执行流程总结 源码分析总结 T ...

  4. MySQL Insert语句单个批次数量过多导致的CPU性能问题分析

    [问题] 最近有台服务器比较频繁的CPU报警,表现的特征有CPU sys占比偏高,大量慢查询,大量并发线程堆积.后面开发对insert的相关业务限流后,服务器性能恢复正常. [异常期间线程处理情况] ...

  5. Android IntentService

    IntentService简要分析 IntentService 继承自 android.app.Service.内部实现极其简单. 首先在 onCreate()中去开启了一个 HandlerThrea ...

  6. python-arcade时钟

    最近开始学习arcade的图形库,感觉功能很丰富,尝试画了个时钟,显示如下: 贴上调整好的代码: import arcade import math,time SCREEN_WIDTH = 800 S ...

  7. 1014 Waiting in Line (30)(30 point(s))

    problem Suppose a bank has N windows open for service. There is a yellow line in front of the window ...

  8. Keystone几种token生成的方式分析

    从Keystone的配置文件中,我们可见,Token的提供者目前支持四种. Token Provider:UUID, PKI, PKIZ, or Fernet 结合源码及官方文档,我们用一个表格来阐述 ...

  9. linux 设备文件和设备之间联系的建立

    <设备驱动模型>  注:几乎所有的设备结构体都包含"strcut kobject kobj"和"srtuct list_head list"该结构体 ...

  10. Centos 安装 Wireshark

    Wireshark是一款数据包识别软件,应用很广泛. yum install wireshark yum install wireshark-gnome