博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
flume使用方法
阅读量:4160 次
发布时间:2019-05-26

本文共 1918 字,大约阅读时间需要 6 分钟。

1.一个简单的例子

1.写配置文件01localDir_local.flu#flume中一个基本单元式agent,可以有多个channel,多个sink#给代理起名称, 不需要声明直接使用#分布给a1代理下的source  channel sink起一个名称#a1代理下sources有一个名为s1#如果有多个:a1.channels=c1 c2 c3sources = s1a1.channels=c1a1.sinks=k1#指定source类型  监控本地目录a1.sources.s1.type = spooldir#指定代理中的channela1.sources.s1.channels = c1#本地目录,需要监控的目录,一旦该目录有新的数据写入,就会自动传递a1.sources.s1.spoolDir = /home/wangfutai/a/flume/logsa1.sources.s1.fileHeader = true#channels 类型,使用本地磁盘文件作为缓冲a1.channels.c1.type = file#用于记录消息队列位置a1.channels.c1.checkpointDir = /home/wangfutai/a/flume/checkPoint#数据缓冲原始数据a1.channels.c1.dataDirs = /home/wangfutai/a/flume/dataa1.sinks.k1.type = loggera1.sinks.k1.channel = c12.开启flume 目录agent options:  --name,-n 
指定agent名称 the name of this agent (required) --conf-file,-f
指定配置文件的路径 specify a config file (required if -z missing) --zkConnString,-z
specify the ZooKeeper connection to use (required if -f missing) --zkBasePath,-p
specify the base path in ZooKeeper for agent configs --no-reload-conf do not reload config file if changed --help,-h display help text命令:flume-ng agent --name a1 --conf-file /home/wangfutai/a/flume/conf/02localDir_local.flu一旦有新的文本,输入到监控目录,此时,flume负责把文本传输到sink指定的位置。每处理一个文本,就会把文本设置成文件名.COMPLETED 表示已经传输完毕在监控目录下,如果文件是隐藏的,隐藏文件不会传输

2.监控一个可执行的进程产生的日志

a1.sources = s1a1.channels=c1a1.sinks=k1a1.sources.s1.type = execa1.sources.s1.command = tail -F /home/wangfutai/a/flume/1.txta1.sources.s1.channels = c1a1.channels = c1a1.channels.c1.type = memory#缓冲 事件个数a1.channels.c1.capacity = 10000传输到sink,一次事件个数a1.channels.c1.transactionCapacity = 10000#阈值百分比a1.channels.c1.byteCapacityBufferPercentage = 20#内存大小a1.channels.c1.byteCapacity = 800000a1.sinks.k1.type = loggera1.sinks.k1.channel = c1测试方式:[wangfutai@wangfutai flume]$ echo "xxxxxxxxxxx">>1.txt[wangfutai@wangfutai flume]$ echo "dddddddddx">>1.txt

  测试结果

 

转载地址:http://pgjxi.baihongyu.com/

你可能感兴趣的文章
图文介绍openLDAP在windows上的安装配置
查看>>
Pentaho BI开源报表系统
查看>>
Pentaho 开发: 在eclipse中构建Pentaho BI Server工程
查看>>
JSP的内置对象及方法
查看>>
android中SharedPreferences的简单例子
查看>>
android中使用TextView来显示某个网址的内容,使用<ScrollView>来生成下拉列表框
查看>>
andorid里关于wifi的分析
查看>>
Spring MVC和Struts2的比较
查看>>
Hibernate和IBatis对比
查看>>
Spring MVC 教程,快速入门,深入分析
查看>>
Android 的source (需安装 git repo)
查看>>
LOCAL_PRELINK_MODULE和prelink-linux-arm.map
查看>>
Simple Guide to use the gdb tool in Android environment
查看>>
Netconsole to capture the log
查看>>
Build GingerBread on 32 bit machine.
查看>>
How to make SD Card world wide writable
查看>>
Detecting Memory Leaks in Kernel
查看>>
Linux initial RAM disk (initrd) overview
查看>>
Timestamping Linux kernel printk output in dmesg for fun and profit
查看>>
There's Much More than Intel/AMD Inside
查看>>