Flume 是 Cloudera 公司开源出来的一套日志收集系统。模型如下所示:

图中Source,Sink分别代表数据源和数据目的地,channel表示Source和Sink之间的通道。配置文件为/path/to/flume/conf/flume.conf

# Define a memory channel called ch1 on agent1
agent1.channels.ch1.type = memory # Define an Avro source called avro-source1 on agent1 and tell it
# to bind to 0.0.0.0:41414. Connect it to channel ch1.
agent1.sources.avro-source1.channels = ch1
agent1.sources.avro-source1.type = avro
agent1.sources.avro-source1.bind = 0.0.0.0
agent1.sources.avro-source1.port = 41414 # Define a logger sink that simply logs all events it receives
# and connect it to the other end of the same channel.
agent1.sinks.log-sink1.channel = ch1
agent1.sinks.log-sink1.type = hdfs
agent1.sinks.log-sink1.hdfs.path = hdfs://qaserver:9001/hello/helloworld # Finally, now that we've defined all of our components, tell
# agent1 which ones we want to activate.
agent1.channels = ch1
agent1.sources = avro-source1
agent1.sinks = log-sink1

启动flume

/path/to/flume/bin/flume-ng agent --conf /path/to/flume/conf/ -f /path/to/flume/conf/flume.conf -Dflume.root.logger=DEBUG,console -n agent1

执行以下命令将./hello.txt内容发送到avro-source1,即本地端口41414。

/path/to/flume/bin/flume-ng avro-client -H localhost -p 41414 -F ./hello.txt

./hello.txt内容如下

Hello World!

查看HDFS文件内容
hadoop fs -cat /hello/helloworld/FlumeData.1394013090403
ƒšî‘ÓD‘§´Ùache.hadoop.io.LongWritable"org.apache.hadoop.io.BytesWritable…=>ûù7ög
           Hello World!

Flume Hello World!的更多相关文章

  1. flume【源码分析】分析Flume的启动过程

    h2 { color: #fff; background-color: #7CCD7C; padding: 3px; margin: 10px 0px } h3 { color: #fff; back ...

  2. 【翻译】Flume 1.8.0 User Guide(用户指南)

    翻译自官网flume1.8用户指南,原文地址:Flume 1.8.0 User Guide 篇幅限制,分为以下5篇: [翻译]Flume 1.8.0 User Guide(用户指南) [翻译]Flum ...

  3. 解决flume运行中的一个异常问题!

    今天在本地测试flume的exec  监控文件   分割的问题!!!遇到各种141异常问题! 怀疑是在切割文件的时候超过了监控文本的时间,导致flume异常退出,,,所以增加了keep-alive 时 ...

  4. Flume NG Getting Started(Flume NG 新手入门指南)

    Flume NG Getting Started(Flume NG 新手入门指南)翻译 新手入门 Flume NG是什么? 有什么改变? 获得Flume NG 从源码构建 配置 flume-ng全局选 ...

  5. 基于Flume+LOG4J+Kafka的日志采集架构方案

    本文将会介绍如何使用 Flume.log4j.Kafka进行规范的日志采集. Flume 基本概念 Flume是一个完善.强大的日志采集工具,关于它的配置,在网上有很多现成的例子和资料,这里仅做简单说 ...

  6. 今天又学了一招,牛逼!!!解决"-bash:No such file or directory"问题

    今天在64服务器上:发现好像bash 坏了,用户名前边   用-bash 显示,,前几天就发现这个问题,,,但是当时忙没有解决,,,,,今天来看看到底是怎么回事! File Exists but... ...

  7. flume 配置

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

  8. sqoop、flume 安装

    sqoop安装步骤 1.上传解压tar包 tar -zxvf  sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz 2.修改配置文件 进入 sqoop/conf/ c ...

  9. flume坑之channel.transactionCapacity和HdfsSink.batchSize

    不说过程了,直接说结果!一对相连接的channel-HdfsSink,无意间配置如下:...agent.channels.common-channel.transactionCapacity=10.. ...

随机推荐

  1. 学习笔记day5:inline inline-block block区别

    1. block元素可以包含block元素和inline元素:但inline元素只能包含inline元素.要注意的是这个是个大概的说法,每个特定的元素能包含的元素也是特定的,所以具体到个别元素上,这条 ...

  2. 子div用了float浮动之后,如何撑开父元素,让父元素div自动适应高度的问题

    方法一: html: <div id="all1"> <div id="left1">1</div> <div id= ...

  3. Python学习(4)运算符

    目录 Python 算术运算符 Python 比较运算符 Python 赋值运算符 Python 位运算符 Python 逻辑运算符 Python 成员运算符 Python 身份运算符 Python  ...

  4. git命令之git rebase 的用法

    rebase 假设你现在基于远程分支"origin",创建一个叫"mywork"的分支. $ git checkout -b mywork origin 现在我 ...

  5. String.join()方法的使用

    String.join()方法是JDK1.8之后新增的一个静态方法,使用方式如下所示: String  result = String.join("-","java&qu ...

  6. Java / JVM CPU 利用率高 - 诊断方法 1 - Thread Dump 结合 OS 诊断

    IBM AIX Java 1. topas 命令定位 CPU 使用高的进程,比如下面 PID 614852 Name            PID  CPU% java         614852  ...

  7. VC++导入导出类

    一.导出类 VC++中导出类很简单,下面列出了两个等价的方法: 方法1: class __declspec(dllexport) CTest { public: int        m_nValue ...

  8. Unity5 新功能解析--GI(全局光)

    http://blog.csdn.net/leonwei/article/details/48009059 Unity5带来的最大的改变就是全新的GI,在烘焙引擎上抛弃了4的beast,使用了虚幻采用 ...

  9. robot API笔记6

    robot.libraries 计划举办机器人框架标准测试库. 图书馆是主要用于外部的测试数据,但是他们可以 也使用自定义测试库是否有必要. 特别是 的内装式 图书馆通常是有用的 当需要与框架. 因为 ...

  10. Java中print、printf、println

    Java中的System.out输出会用到print.println以及printf命令. 其中 print一般的标准输出,但是不换行. println对比print即在结尾处多了换行.  eg:pr ...