• flume


    # example.conf: A single-node Flume configuration
     
    # Name the components on this agent
    a1.sources = r1
    a1.sinks = k1
    a1.channels = c1
     
    # Describe/configure the source
    a1.sources.r1.type = netcat
    a1.sources.r1.bind = localhost
    a1.sources.r1.port = 44444
     
    # Describe the sink
    a1.sinks.k1.type = logger
     
    # 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

    将上述配置存为:example.conf

    然后我们就可以启动 Flume 了:

    1
    bin/flume-ng agent --conf conf --conf-file conf/example.conf --name a1 -Dflume.root.logger=INFO,console

    PS:-Dflume.root.logger=INFO,console 仅为 debug 使用,请勿生产环境生搬硬套,否则大量的日志会返回到终端。。。

    -c/--conf 后跟配置目录,-f/--conf-file 后跟具体的配置文件,-n/--name 指定agent的名称

    然后我们再开一个 shell 终端窗口,telnet 上配置中侦听的端口,就可以发消息看到效果了:

     然后我们再开一个 shell 终端窗口,telnet 上配置中侦听的端口,就可以发消息看到效果了:

     
    1
    2
    3
    4
    5
    6
    $ telnet localhost 44444
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    Hello world! <ENTER>
    OK

    Flume 终端窗口此时会打印出如下信息,就表示成功了:

    1
    2
    3
    12/06/19 15:32:19 INFO source.NetcatSource: Source starting
    12/06/19 15:32:19 INFO source.NetcatSource: Created serverSocket:sun.nio.ch.ServerSocketChannelImpl[/127.0.0.1:44444]
    12/06/19 15:32:34 INFO sink.LoggerSink: Event: { headers:{} body: 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 0D          Hello world!.

    http://my.oschina.net/leejun2005/blog/288136

    http://idoall.org/home.php?mod=space&uid=1&do=blog&id=550

    http://blog.javachen.com/2014/07/22/flume-ng/

    http://www.tuicool.com/articles/ruyANnF

  • 相关阅读:
    4、CreateJS介绍-PreLoadJS
    3、CreateJS介绍-SoundJS
    洛谷 题解 UVA1151 【买还是建 Buy or Build】
    算法详解之拓扑排序
    算法详解之缩点
    洛谷 题解 P3627 【[APIO2009]抢掠计划】
    板娘脚本
    2019.6.20义乌测试赛自我成绩分析
    洛谷 题解 P1225 【黑白棋游戏】
    洛谷 题解 P1908 【逆序对】
  • 原文地址:https://www.cnblogs.com/gym333/p/4485917.html
Copyright © 2020-2023  润新知