flume-ng配置文件详解(二)
来源:互联网 发布:伊朗空军实力知乎 编辑:程序博客网 时间:2024/05/17 21:40
4 Syslogtcp案例
agent1.sources = r1
agent1.sinks = k1
agent1.channels = c1
agent1.sources.r1.type = syslogtcp
agent1.sources.r1.port = 5000
agent1.sources.r1.host = 192.168.100.200
agent1.sources.r1.channels = c1
agent1.sinks.k1.type = logger
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100
agent1.sources.r1.channels = c1
agent1.sinks.k1.channel = c1
[root@localhost apache-flume-1.7.0-bin]# bin/flume-ng agent --conf conf --conf-file conf/tcp.conf --name agent1 -Dfilume.root.loggger=INFO,console
[root@localhost logs]# echo "hello flume" | nc 192.168.100.200 5000
[root@localhost apache-flume-1.7.0-bin]# vi logs/flume.log
21 Nov 2016 00:43:22,220 INFO [SinkRunner-PollingRunner-DefaultSinkProcessor] (org.apache.flume.sink.LoggerSink.process:95)
- Event: { headers:{Severity=0, flume.syslog.status=Invalid, Facility=0} body: 68 65 6C 6C 6F 20 66 6C 75 6D 65 hello flume }
5 JSONHandler案例
[root@localhost apache-flume-1.7.0-bin]# vi conf/json.conf
agent1.sources = r1
agent1.sinks = k1
agent1.channels = c1
agent1.sources.r1.type = org.apache.flume.source.http.HTTPSource
agent1.sources.r1.port = 8888
agent1.sources.r1.channels = c1
agent1.sinks.k1.type = logger
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100
agent1.sources.r1.channels = c1
agent1.sinks.k1.channel = c1
[root@localhost apache-flume-1.7.0-bin]# bin/flume-ng agent --conf conf --conf-file conf/json.conf --name agent1 -Dfilume.root.loggger=INFO,console
[root@localhost apache-flume-1.7.0-bin]# curl -X POST -d '[{ "headers" :{"a" : "a1","b" : "b1"},"body" : "hello flume"}]' http://192.168.100.200:8888
[root@localhost apache-flume-1.7.0-bin]# vi logs/flume.log
21 Nov 2016 00:50:44,153 INFO [SinkRunner-PollingRunner-DefaultSinkProcessor] (org.apache.flume.sink.LoggerSink.process:95)
- Event: { headers:{b=b1, a=a1} body: 68 65 6C 6C 6F 20 66 6C 75 6D 65 hello flume }
6 Hadoop sink案例
[root@localhost apache-flume-1.7.0-bin]# vi conf/hdfs.conf
agent1.sources = r1
agent1.sinks = k1
agent1.channels = c1
agent1.sources.r1.type = syslogtcp
agent1.sources.r1.port = 5140
agent1.sources.r1.host = 192.168.100.200
agent1.sources.r1.channels = c1
agent1.sinks.k1.type = hdfs
agent1.sinks.k1.channel = c1
agent1.sinks.k1.hdfs.path = hdfs://192.168.100.200:9000/flume
agent1.sinks.k1.hdfs.filePrefix = Syslog
agent1.sinks.k1.hdfs.round = true
agent1.sinks.k1.hdfs.roundValue = 10
agent1.sinks.k1.hdfs.roundUnit = minute
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100
agent1.sources.r1.channels = c1
agent1.sinks.k1.channel = c1
[root@localhost apache-flume-1.7.0-bin]# bin/flume-ng agent --conf conf --conf-file conf/hdfs.conf --name agent1 -Dfilume.root.loggger=INFO,console
[root@localhost apache-flume-1.7.0-bin]# echo "hello flume -> hadoop hdfs" | nc 192.168.100.200 5140
pig客户端查看目录
grunt> ls /
7 File Roll Sink案例
[root@localhost apache-flume-1.7.0-bin]# vi conf/fileroll.conf
agent1.sources = r1
agent1.sinks = k1
agent1.channels = c1
agent1.sources.r1.type = syslogtcp
agent1.sources.r1.port = 5555
agent1.sources.r1.host = 192.168.100.200
agent1.sources.r1.channels = c1
agent1.sinks.k1.type = file_roll
agent1.sinks.k1.sink.directory = /usr/local/logs
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100
agent1.sources.r1.channels = c1
agent1.sinks.k1.channel = c1
[root@localhost apache-flume-1.7.0-bin]# echo "hello flume fileroll" | nc 192.168.100.200 5555
[root@localhost apache-flume-1.7.0-bin]# cd /usr/local/logs/
查看具体文件
[root@localhost logs]# cat 1479719885810-2
hello flume fileroll
- flume-ng配置文件详解(二)
- flume-ng配置文件详解(一)
- flume-ng配置文件详解(三)
- flume-ng配置文件详解(四)
- 【Java】【Flume】Flume-NG启动过程源码分析(二)
- 【Java】【Flume】Flume-NG启动过程源码分析(二)
- Flume NG 配置详解
- Flume NG 配置详解
- Flume-ng禁用自动加载配置文件功能
- Flume-ng禁用自动加载配置文件功能
- flume properties配置文件详解
- Flume-ng生产环境实践(二)flume-ng 测试过程中event丢失部分body数据
- Flume-ng生产环境实践(二)flume-ng 测试过程中event丢失部分body数据
- Flume NG 学习笔记(二)单机与集群Flume 配置
- Flume NG高可用集群搭建详解(基于flume-1.7.0)
- flume-ng demo单机配置详解
- flume-ng
- Flume NG
- 天使
- 解决 Must have one-pixel frame that is either transparent or white
- 关于登录的自己总结
- python 验证码
- macvtap介绍
- flume-ng配置文件详解(二)
- 程序猿媳妇儿注意事项
- 学习Collections对list做排序
- JQuery中$.ajax()方法参数详解
- 朴素贝叶斯原理及Python实现
- 第十二周oj题目输出已经交换的两个数
- iPhone通讯录底部不显示联系人的数量
- 习题47 自动化测试
- SendInput模拟Win(VK_LWIN)键的问题