zoukankan      html  css  js  c++  java
  • fiume数据采集工具

    搭环境,只需配置Java_home就好了。

    写一个a2.conf文件

    执行参考:bin/flume-ng agent -n a2 -f /home/hadoop/a2.conf -c conf -Dflume.root.logger=INFO,console

    a2.conf

    #定义agent名, source、channel、sink的名称
    a2.sources = r1
    a2.channels = c1
    a2.sinks = k1

    #具体定义source
    a2.sources.r1.type = exec    // exec 启动一个新shell
    a2.sources.r1.command = tail -F /home/hadoop/a.log     // tail -f 动态日志

    #具体定义channel
    a2.channels.c1.type = memory
    a2.channels.c1.capacity = 1000
    a2.channels.c1.transactionCapacity = 100

    #具体定义sink
    a2.sinks.k1.type = logger

    #组装source、channel、sink
    a2.sources.r1.channels = c1
    a2.sinks.k1.channel = c1

    例:a4.conf

    #定义agent名, source、channel、sink的名称
    a4.sources = r1
    a4.channels = c1
    a4.sinks = k1

    #具体定义source
    a4.sources.r1.type = spooldir
    a4.sources.r1.spoolDir = /home/hadoop/logs

    #具体定义channel
    a4.channels.c1.type = memory
    a4.channels.c1.capacity = 10000
    a4.channels.c1.transactionCapacity = 100

    #定义拦截器,为消息添加时间戳(本例子中没使用拦截而是使用了添加时间戳)
    a4.sources.r1.interceptors = i1
    a4.sources.r1.interceptors.i1.type = org.apache.flume.interceptor.TimestampInterceptor$Builder


    #具体定义sink
    a4.sinks.k1.type = hdfs
    a4.sinks.k1.hdfs.path = hdfs://ns1/flume/%Y%m%d      // 时间戳生成的时间,年月日显示   ; flume不知道ns1是什么,把hadoop里的core-site.xml 和 hdfs-site.xml拷贝到flume的conf里
    a4.sinks.k1.hdfs.filePrefix = events-
    a4.sinks.k1.hdfs.fileType = DataStream
    #不按照条数生成文件
    a4.sinks.k1.hdfs.rollCount = 0
    #HDFS上的文件达到128M时生成一个文件
    a4.sinks.k1.hdfs.rollSize = 134217728
    #HDFS上的文件达到60秒生成一个文件
    a4.sinks.k1.hdfs.rollInterval = 60

    #组装source、channel、sink
    a4.sources.r1.channels = c1
    a4.sinks.k1.channel = c1

    执行的时候会报三个左右的错,是因为缺少jar包导致的,需要把hadoop里的部分jar包拷到flume里,但是不能全部复制过去,导致jar包混乱

  • 相关阅读:
    hadoop 2.6.0 LightWeightGSet源码分析
    推断扫描后的内容是否是URL
    Merge Sorted Array
    带条件的分页【重点】
    第8章2节《MonkeyRunner源代码剖析》MonkeyRunner启动执行过程-解析处理命令行參数
    php持续集成环境笔记
    hdu5137 How Many Maos Does the Guanxi Worth(单源最短路径)
    求最长公共子序列
    集团公司(嵌入ETL工具)財务报表系统解决方式
    ADT+NDK搭建jni编译环境
  • 原文地址:https://www.cnblogs.com/double-orange/p/10234180.html
Copyright © 2011-2022 走看看