zoukankan      html  css  js  c++  java
  • 寒假学习(十二)使用 netcat 数据源测试 Flume

    使用 netcat 数据源测试 Flume
    请对 Flume 的相关配置文件进行设置,从而可以实现如下功能:在一个 Linux 终端(这
    里称为“Flume 终端”)中,启动 Flume,在另一个终端(这里称为“Telnet 终端”)中,
    输入命令“telnet localhost 44444”,然后,在 Telnet 终端中输入任何字符,让这些字符可以
    顺利地在 Flume 终端中显示出来。
    ⑴创建 agent 配置文件
    1.cd /usr/local/flume
    2.sudo vim ./conf/example.conf
    在 example.conf 里写入以下内容:
    1.#example.conf: A single-node Flume configuration
    2.# Name the components on this agent
    3.a1.sources = r1
    4.a1.sinks = k1
    5.a1.channels = c1
    6.# Describe/configure the source
    7.a1.sources.r1.type = netcat
    8.a1.sources.r1.bind = localhost
    9.a1.sources.r1.port = 44444
    10.#同上,记住该端口名
    11.# Describe the sink
    12.a1.sinks.k1.type = logger
    13.# Use a channel which buffers events in memory
    14.a1.channels.c1.type = memory
    15.a1.channels.c1.capacity = 1000
    16.a1.channels.c1.transactionCapacity = 100
    17.# Bind the source and sink to the channel
    18.a1.sources.r1.channels = c1
    19.a1.sinks.k1.channel = c1
       
    ⑵启动 flume agent (即打开日志控制台):
    1./usr/local/flume/bin/flume-ng agent --conf ./conf
    --conf-file ./conf/example.conf --name a1
    -Dflume.root.logger=INFO,console
    再打开一个终端,输入命令:telnet localhost 44444
    1.telnet localhost 44444
    2.#前面编辑 conf 文件的端口名
    第一个终端的日志控制台显示:
     
    netcatsource 运行成功!
  • 相关阅读:
    【LGOJ4147】玉蟾宫
    【BJWC2012】冻结
    【JSOI2016】最佳团体
    TCP三次握手是什么?为什么要进行三次握手?两次,四次握手可以吗?
    TCP 和 UDP的最完整的区别
    素数环问题为什么不能是奇数?
    malloc、calloc、new的区别
    请实现两个函数,分别用来序列化和反序列化二叉树
    int* &p 讲解
    c++中常用容器讲解
  • 原文地址:https://www.cnblogs.com/sonofdemon/p/12301759.html
Copyright © 2011-2022 走看看