zoukankan      html  css  js  c++  java
  • 使用 Avro 数据源测试 Flume

    2. 使用 Avro 数据源测试 Flume
    Avro 可以发送一个给定的文件给 Flume,Avro 源使用 AVRO RPC 机制。请对 Flume
    的相关配置文件进行设置,从而可以实现如下功能:在一个终端中新建一个文件
    helloworld.txt(里面包含一行文本“Hello World”),在另外一个终端中启动 Flume 以后,
    可以把 helloworld.txt 中的文本内容显示出来。

    cd /usr/local/flume
    sudo vim ./conf/avro.conf

    添加如下:

    a1.sources = r1
    a1.sinks = k1
    a1.channels = c1
    
    # Describe/configure the source
    a1.sources.r1.type = avro
    a1.sources.r1.channels = c1
    a1.sources.r1.bind = 0.0.0.0
    a1.sources.r1.port = 4141
    
    # 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

    将helloworld.txt放在flume的主目录路径下。

     启动agent

    ./bin/flume-ng agent agent -c conf -f ./conf/avro.conf -n a1 -Dflume.root.logger=INFO,console

    在同目录下新建一个命令终端,使用avro-client发送文件

    ./bin/flume-ng avro-client -H localhost -p 4141 -F ./helloworld.txt

    这是就可以在第一个命令终端中看到输出的“hello world!”了

  • 相关阅读:
    【图】max51开发板(手工焊接)
    【图】max51开发板3D效果图
    【图】AT89S52原理页
    频率 时间 单位转换
    [AD 技巧]Altium Designer元件换层
    Windows 的承载网络设置方法
    Windows 定时自动开/关机
    Windows 操作系统快捷键
    转义符 与 转义字符
    keil 中的快捷键
  • 原文地址:https://www.cnblogs.com/a155-/p/14294063.html
Copyright © 2011-2022 走看看