案例一: source:hive.log channel: memory  sink: logger输出

拷贝一份flume-conf.properties.template改名为hive-mem-log.properties
hive-mem-log.properties
  a1.sources = s1
  a1.channels = c1
  a1.sinks = k1
  # defined the source
  a1.sources.s1.type = exec
  a1.sources.s1.command = tail -F /opt/cdh-5.6.3/hive-0.13.1-cdh5.3.6/logs/hive.log
  a1.sources.s1.shell = /bin/sh -c
  # defined the channel
  a1.channels.c1.type = memory
  # defined the sink
  a1.sinks.k1.type = logger
  # The channel can be defined as follows.
  a1.sources.s1.channels = c1
  a1.sinks.k1.channel = c1
flmue目录下执行
  bin/flume-ng agent -c conf/ -n al -f conf/hive-mem-log.properties -Dflume.root.logger=INFO,console
  在hive端打印几条命令查看
注意flume的启动顺序和关闭顺序是不同的

案例二:source:hive.log channel: file  sink: logger输出

拷贝一份flume-conf.properties.template改名为hive-file-log.properties
hive-file-log.properties
  a1.sources = s1
  a1.channels = c1
  a1.sinks = k1
  # defined the source
  a1.sources.s1.type = exec
  a1.sources.s1.command = tail -F /opt/cdh-5.6.3/hive-0.13.1-cdh5.3.6/logs/hive.log
  a1.sources.s1.shell = /bin/sh -c
  # defined the channel
  a1.channels.c1.type = file
  a1.channels.c1.checkpointDir = /opt/cdh-5.6.3/apache-flume-1.5.0-cdh5.3.6-bin/datas/checkp
  a1.channels.c1.dataDirs = /opt/cdh-5.6.3/apache-flume-1.5.0-cdh5.3.6-bin/datas/data
  # defined the sink
  a1.sinks.k1.type = logger
  # The channel can be defined as follows.
  a1.sources.s1.channels = c1
  a1.sinks.k1.channel = c1
flmue目录下执行
  bin/flume-ng agent -c conf/ -n a1 -f conf/hive-file-log.properties -Dflume.root.logger=INFO,console
  查看自定义文件夹下数据文件

案例三:source:hive.log channel: mem  sink: hdfs

拷贝一份flume-conf.properties.template改名为hive-mem-hdfs.properties
hive-mem-hdfs.properties
  a1.sources = s1
  a1.channels = c1
  a1.sinks = k1
  # defined the source
  a1.sources.s1.type = exec
  a1.sources.s1.command = tail -F /opt/cdh-5.6.3/hive-0.13.1-cdh5.3.6/logs/hive.log
  a1.sources.s1.shell = /bin/sh -c
  # defined the channel
  a1.channels.c1.type = memory
  a1.channels.c1.capacity = 1000
  a1.channels.c1.transactionCapacity = 1000
  # defined the sink
  a1.sinks.k1.type = hdfs
  a1.sinks.k1.hdfs.path = /flume/hdfs/
  a1.sinks.k1.hdfs.fileType = DataStream
  # The channel can be defined as follows.
  a1.sources.s1.channels = c1
  a1.sinks.k1.channel = c1
flmue目录下执行
  bin/flume-ng agent -c conf/ -n a1 -f conf/hive-mem-hdfs.properties -Dflume.root.logger=INFO,console
  查看HDFS下数据文件
  可以发现,定义的目录不存在时,会自动被创建

Flume_使用的更多相关文章

  1. Flume_企业中日志处理

    企业中的日志存放_1 201611/20161112.log.tmp 第二天文件变为20161112.log与20161113.log.tmp 拷贝一份flume-conf.properties.te ...

  2. Flume_常见的几个问题

    在HDFS的文件默认生成文件大小1K,如何设置文件大小和数量 拷贝一份flume-conf.properties.template改名为hive-mem-size.properties hive-me ...

  3. Flume_初识

    企业架构 数据源 webserver RDBMS 数据的采集 shell.flume.sqoop job 监控和调度 hue.oozie 数据清洗及分析 mapreduce.hive 数据保存 sqo ...

随机推荐

  1. soj 2013年 Nanjing Slection

    这样加边比STL快! 不明白为什么要+mod #include<iostream> #include<cstdio> #include<queue> #includ ...

  2. Discuzx系统 CSS 编码规范,CSS属性书写顺序

    1. 属性写在一行内,属性之间.属性名和值之间以及属性与“{}”之间须有空格,例如:.class { width: 400px; height: 300px; }     2. 属性的书写顺序:    ...

  3. 【阮一峰】深入研究URL编码问题及JavaScript相应的解决方案

    作者: 阮一峰 日期: 2010年2月11日 一.问题的由来 URL就是网址,只要上网,就一定会用到. 一般来说,URL只能使用英文字母.阿拉伯数字和某些标点符号,不能使用其他文字和符号.比如,世界上 ...

  4. php分页类

    1.需求 学会php分页类的使用 2.参考例子 CI的分页类 3.代码部分 <?php class pagination{ public $pagesize=20; public $pagein ...

  5. 一个简单的servlet的demo

    javaweb  的应用我们需要参考javaee  api 查找servlet接口 javax.servletInterface Servlet All Known Subinterfaces: Ht ...

  6. Unity3D 更新文件下载器

    使用说明: 1)远端更新服务器目录 Package |----list.txt |----a.bundle |----b.bundle 2)list.txt是更新列表文件 格式是 a.bundle|r ...

  7. Laravel 创建数据库

    1.根目录输入 php artisan migrate 2.创建表 php artisan migrate:make create_authors_table --table authors --cr ...

  8. vim编辑技巧

    算上大学上课linux接触四年了,可惜除了工作接触的那些,其他地方还是很水的,都不精通,今日翻来看了看以前过目即忘的vim技巧,发现,如无几年操作经验,这些技巧很难领悟的.这里写下来,以备后查. 区块 ...

  9. mysql触发器,答题记录表同步教学跟踪(用户列表)

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABVQAAAOOCAIAAABgEw4AAAAgAElEQVR4nOy92VcT27r/zX+xLtflvt

  10. Rest(表述性状态转移)

    本文的主要内容有: 1.了解Rest 2.了解RESTful WebService 3.使用SpringMvc实现RESTful ------------------------------我是华丽的 ...