1、下载flume,解压到自建文件夹

2、修改flume-env.sh文件

  在文件中添加JAVA_HOME

3、修改flume.conf 文件(原名好像不叫这个,我自己把模板名改了)

里面我自己配的(具体配置参见 http://flume.apache.org/FlumeUserGuide.html)

agent1 是我的代理名称

source是netcat (数据源)

channel 是memory(内存)

sink是hdfs(输出)

注意配置中添加

agent1.sinks.k1.hdfs.fileType = DataStream

否则hdfs中接收的文件会出现乱码

如果要配置根据时间来分类写入hdfs的功能,要求传入的文件必须要有时间戳(datastamp)

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License. # The configuration file needs to define the sources,
# the channels and the sinks.
# Sources, channels and sinks are defined per agent,
# in this case called 'agent' agent1.sources = r1
agent1.channels = c1
agent1.sinks = k1 # For each one of the sources, the type is defined
agent1.sources.r1.type = netcat
agent1.sources.r1.channels = c1
#agent1.sources.r1.ack-every-event = false
agent1.sources.r1.max-line-length = 100
agent1.sources.r1.bind = 192.168.19.107
agent1.sources.r1.port = 44445 # Describe/configure the interceptor #agent1.sources.r1.interceptors = i1
#agent1.sources.r1.interceptors.i1.type = com.nd.bigdata.insight.interceptor.KeyTimestampForKafka$Builder # Each sink's type must be defined
#agent1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
#agent1.sinks.k1.topic = insight-test6
#agent1.sinks.k1.brokerList =192.168.181.120:9092,192.168.181.121:9092,192.168.181.66:9092
#agent1.sinks.k1.batchSize=100
#agent1.sinks.k1.requiredAcks = 0 # logger
#agent1.sinks.k1.type = logger
#agent1.sinks.k1.channel = c1 #HDFS
agent1.sinks.k1.type = hdfs
agent1.sinks.k1.channel = c1
agent1.sinks.k1.hdfs.path = test/flume/events/
agent1.sinks.k1.hdfs.filePrefix = events-
agent1.sinks.k1.hdfs.round = true
agent1.sinks.k1.hdfs.roundValue = 10
agent1.sinks.k1.hdfs.roundUnit = minute
agent1.sinks.k1.hdfs.fileType = DataStream # Each channel's type is defined.
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
"flume.conf" 70L, 2291C

4、启动flume:(文件根目录下启动)

bin/flume-ng agent --conf conf --conf-file conf/flume.conf --name agent1 -Dflume.root.logger=INFO,console(里面的flume.conf ,agent1 请替换成你自己的名字)

5、用另一台机试着发送文件

telnet 192.168.19.107  44445  (创建连接)

然后发送内容

6、生成的hdfs文件

flume 配置与使用的更多相关文章

  1. 关于flume配置加载(二)

    为什么翻flume的代码,一方面是确实遇到了问题,另一方面是想翻一下flume的源码,看看有什么收获,现在收获还谈不上,因为要继续总结.不够已经够解决问题了,而且确实有好的代码,后续会继续慢慢分享,这 ...

  2. flume 配置

    [root@dtpweb data]#tar -zxvf apache-flume-1.7.0-bin.tar.gz[root@dtpweb conf]# cp flume-env.sh.templa ...

  3. 关于flume配置加载

    最近项目在用到flume,因此翻了下flume的代码, 启动脚本: nohup bin/flume-ng agent -n tsdbflume -c conf -f conf/配置文件.conf -D ...

  4. Flume配置Replicating Channel Selector

    1 官网内容 上面的配置是r1获取到的内容会同时复制到c1 c2 c3 三个channel里面 2 详细配置信息 # Name the components on this agent a1.sour ...

  5. Flume配置Multiplexing Channel Selector

    1 官网内容 上面配置的是根据不同的heder当中state值走不同的channels,如果是CZ就走c1 如果是US就走c2 c3 其他默认走c4 2 我的详细配置信息 一个监听http端口 然后 ...

  6. hadoop生态搭建(3节点)-09.flume配置

    # http://archive.apache.org/dist/flume/1.8.0/# ===================================================== ...

  7. flume配置和说明(转)

    Flume是什么 收集.聚合事件流数据的分布式框架 通常用于log数据 采用ad-hoc方案,明显优点如下: 可靠的.可伸缩.可管理.可定制.高性能 声明式配置,可以动态更新配置 提供上下文路由功能 ...

  8. flume配置参数的意义

    1.监控端口数据: flume启动: [bingo@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a1 --conf-file jo ...

  9. Flume配置Failover Sink Processor

    1 官网内容 2 看一张图一目了然 3 详细配置 source配置文件 #配置文件: a1.sources= r1 a1.sinks= k1 k2 a1.channels= c1 #负载平衡 a1.s ...

随机推荐

  1. ASP-AJAX-分页格式

    HTML: <html> <head> <title>Mazey</title> <meta name="description&quo ...

  2. cocos2dx使用cocostudio导出的scene

    local uilocal function createLayerUI() if not ui then ui=cc.Layer:create(); createLayerUI=nil; end r ...

  3. Android系统移植与调试之------->如何修改Android设备添加重启、飞行模式、静音模式等功能(二)

    今天要说的是为Android设备添加重启.飞行模式.静音模式按钮,客户需求中需要添加这项功能,在长按电源键弹出的菜单中没有这些选项,谨以此文记录自己添加这个功能的过程. 首先找到长按电源键弹出的对话框 ...

  4. apche安装教程

    从Apache官网下载windows安装版的Apache服务器了, 现在分享给大家.   1 进入apache服务器官网http://httpd.apache.org/,这里我们以下载稳定版的 htt ...

  5. OpenCV编程->RGB直方图统计

      我们在处理彩色图像时.特别是在做局部图像的阈值切割时,须要一个直观的RGB统计图.   接下来開始实现.    代码: void CalcHistRGB() { IplImage* img_sou ...

  6. python基础10 ---匿名函数和递归

    一.匿名函数 1.lambda表达式就相当于匿名函数,其格式为: lambda 参数列表:参数表达式 2.lambda自带return值,因为匿名函数有个限制,就是只能有一个表达式,不用写return ...

  7. css 分析

    .important.warning {background:silver;} .important .warning {background:silver;} //上面有什么区别? //1.2个选择 ...

  8. [原创]java WEB学习笔记31:会话与状态管理 session机制 概述(定义,session机制,session的声明周期,保存session的方式,Session的创建与删除)

    本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...

  9. 浅谈Android系统开发中LOG的使用【转】

    本文转载自:http://blog.csdn.net/luoshengyang/article/details/6581828 在程序开发过程中,LOG是广泛使用的用来记录程序执行过程的机制,它既可以 ...

  10. CentOS7 + Python3 + Django(rest_framework) + MySQL + nginx + uwsgi 部署 API 开发环境, 记坑篇

    CentOS7 + Python3 + Django(rest_framework) + MySQL + nginx + uwsgi 部署 API 开发环境 CentOS7 + Python3 + D ...