zoukankan      html  css  js  c++  java
  • Spark Streaming——Flume实例

    Flume 官网http://flume.apache.org/releases/content/1.9.0/FlumeUserGuide.html

    此文章共有三个实例:

    crtl+c后停止flume

    实例一直接监控端口

    配置文件

    # 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 = dblab-VirtualBox

    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

     

    # Bind the source and sink to the channel

    a1.sources.r1.channels = c1

    a1.sinks.k1.channel = c1

    启动agent:

    flume-ng agent

    -n a1

    -c $FLUME_HOME/conf

    -f $FLUME_HOME/conf/example.conf

    -Dflume.root.logger=INFO,console

    实例二监控文件

    配置文件

    a1.sources = r1

    a1.sinks = k1

    a1.channels = c1

     

    a1.sources.r1.type = exec

    a1.sources.r1.command = tail -F /home/hadoop/data/data.log

    a1.sources.r1.shell = /bin/sh -c

     

    a1.sinks.k1.type = logger

     

    a1.channels.c1.type = memory

     

    a1.sources.r1.channels = c1

    a1.sinks.k1.channel = c1

    启动agent:

    flume-ng agent

    -n a1

    -c $FLUME_HOME/conf

    -f $FLUME_HOME/conf/exec-memory-logger.conf

    -Dflume.root.logger=INFO,console

    目前是sink到控制台a1.sinks.k1.type = logger 如果是离线处理的话可以sink到HDFS

    书写格式

    实例三Flume实战

    机器配置图

    技术选型:

          A:  exec source +memory channel +avro sink

          B:  avro source +memory channel +logger sink

    配置文件

    exec-memory-avro.conf

    exec-memory-avro.sources = exec-source

    exec-memory-avro.sinks = avro-sink

    exec-memory-avro.channels = memory-channel

     

    exec-memory-avro.sources.exec-source.type = exec

    exec-memory-avro.sources.exec-source.command = tail -F /home/hadoop/data/data.log

    exec-memory-avro.sources.exec-source.shell = /bin/sh -c

     

    exec-memory-avro.sinks.avro-sink.type = avro

    exec-memory-avro.sinks.avro-sink.hostname = dblab-VirtualBox

    exec-memory-avro.sinks.avro-sink.port = 44444

     

    exec-memory-avro.channels.memory-channel.type = memory

     

    exec-memory-avro.sources.exec-source.channels = memory-channel

    exec-memory-avro.sinks.avro-sink.channel = memory-channel

    avro-memory-logger.conf

    avro-memory-logger.sources = avro-source

    avro-memory-logger.sinks = logger-sink

    avro-memory-logger.channels = memory-channel

     

    avro-memory-logger.sources.avro-source.type = avro

    avro-memory-logger.sources.avro-source.bind= dblab-VirtualBox

    avro-memory-logger.sources.avro-source.port=44444

     

    avro-memory-logger.sinks.logger-sink.type = logger

     

    avro-memory-logger.channels.memory-channel.type = memory

     

    avro-memory-logger.sources.avro-source.channels = memory-channel

    avro-memory-logger.sinks.logger-sink.channel = memory-channel

    启动agent:

    先启动avro-memory-logger.conf  wang-one启动

    flume-ng agent --name avro-memory-logger

    --conf $FLUME_HOME/conf

    --conf-file $FLUME_HOME/conf/avro-memory-logger.conf -Dflume.root.logger=INFO,console

    再启动exec-memory-avro.conf  wang-two启动

    flume-ng agent --name exec-memory-avro

    --conf $FLUME_HOME/conf

    --conf-file $FLUME_HOME/conf/exec-memory-avro.conf

    -Dflume.root.logger=INFO,console

    exec-memory-avro.conf

    avro-memory-logger.conf

  • 相关阅读:
    Flash特效 嘿嘿
    惨,被骗了20年
    “不允许对64位应用程序进行修改”的解决方法 “Changes to 64bit applications are not allowed.”
    清除Sql Server数据库日志
    .Net 序列化(去除默认命名空间,添加编码)
    【Vegas原创】X connection to localhost:11.0 broken (explicit kill or server shutdown)解决方法
    【Vegas原创】通过WMIC命令远程打开远程计算机的远程桌面(Remote Desktop)功能
    【Vegas原创】ORA12638: 身份证明检索失败的解决办法
    【Vegas原创】SQL Server 阻止了对组件 'SQL Mail XPs' 的 过程'sys.xp_sendmail' 的访问的解决方法
    【Vegas原创】获取SQL Server处理语句的时间(毫秒)
  • 原文地址:https://www.cnblogs.com/aishanyishi/p/10322795.html
Copyright © 2011-2022 走看看