zoukankan      html  css  js  c++  java
  • Flume Netcat Source

    1.cd /usr/local2/flume/conf

    sudo vim netcat.conf

    • # 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 = 8888
    • # 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  
    2.启动flume agent:
    cd /usr/local2/flume/bin
    soyo@soyo-VPCCB3S1C:/usr/local2/flume/bin$ ./flume-ng agent --conf conf -f /usr/local2/flume/conf/netcat.conf  --name a1
    3.打开另一个shell:
    nc localhost 8888
    输入内容 即可以被flume捕获

    注意:flume 无论是netcat还是avro 都无法显示中文 需要到 **.conf中做配置,但Kafka默认是可以显示中文的
    备注:这个问题在IDEA,spark Streaming 以flume为数据源的程序中 已经解决



  • 相关阅读:
    Emacs教程
    华为上机测试 2015
    奇偶排序
    C语言中的EOF和回车不一样
    jquery 使用方法
    1116
    1115
    1109
    Oracle14~23
    get与post的区别
  • 原文地址:https://www.cnblogs.com/soyo/p/7686840.html
Copyright © 2011-2022 走看看