zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    markdown模式的一些语法
    markdown模式的一些语法
    微信小游戏跳一跳外挂教程(安卓版)
    微信小游戏跳一跳外挂教程(安卓版)
    仿百度地图上拉下滑抽屉盒
    仿百度地图上拉下滑抽屉盒
    验证码倒计时的注册页面
    验证码倒计时的注册页面
    1430 素数判定
    2834 斐波那契数
  • 原文地址:https://www.cnblogs.com/gym333/p/4485917.html
Copyright © 2011-2022 走看看