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包混乱

  • 相关阅读:
    DirectX9:基础篇 第六章 颜色
    DirectX9:应用篇 论OBJ模型文件格式
    MFC:绘图基础
    DirectX9:基础篇 纹理
    DirectX9:应用篇 论OBJ模型文件和.X模型文件互转
    MFC:控件位置调整
    数据结构:二叉树
    DirectX9:总结篇 数据类型结构
    C89:论结构体/枚举体/联合体的使用
    css布局汇总
  • 原文地址:https://www.cnblogs.com/double-orange/p/10234180.html
Copyright © 2011-2022 走看看