赞
踩
目录
Flume是Cloudera提供的一个高可用的,高可靠的,分布式的海量日志采集、聚合和传输的系统。Flume基于流式架构,灵活简单。
[atguigu@node001 flume-1.7.0]$ bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-telnet-logger.conf -Dflume.root.logger=INFO,console
- [atguigu@node001 ~]$ cd /opt/software/telnet
- [atguigu@node001 telnet]$ ll
- 总用量 224
- -rw-rw-r-- 1 atguigu atguigu 59332 4月 10 14:53 telnet-0.17-48.el6.x86_64.rpm
- -rw-rw-r-- 1 atguigu atguigu 37912 4月 10 14:53 telnet-server-0.17-48.el6.x86_64.rpm
- -rw-rw-r-- 1 atguigu atguigu 124812 4月 10 14:53 xinetd-2.3.14-40.el6.x86_64.rpm
- [atguigu@node001 telnet]$ sudo rpm -ivh xinetd-2.3.14-40.el6.x86_64.rpm
- 警告:xinetd-2.3.14-40.el6.x86_64.rpm: 头V3 RSA/SHA1 Signature, 密钥 ID c105b9de: NOKEY
- 准备中... ################################# [100%]
- 正在升级/安装...
- 1:xinetd-2:2.3.14-40.el6 ################################# [100%]
- [atguigu@node001 telnet]$ sudo rpm -ivh telnet-0.17-48.el6.x86_64.rpm
- 警告:telnet-0.17-48.el6.x86_64.rpm: 头V3 RSA/SHA1 Signature, 密钥 ID c105b9de: NOKEY
- 准备中... ################################# [100%]
- 正在升级/安装...
- 1:telnet-1:0.17-48.el6 ################################# [100%]
- [atguigu@node001 telnet]$ sudo rpm -ivh telnet-server-0.17-48.el6.x86_64.rpm
- 警告:telnet-server-0.17-48.el6.x86_64.rpm: 头V3 RSA/SHA1 Signature, 密钥 ID c105b9de: NOKEY
- 准备中... ################################# [100%]
- 正在升级/安装...
- 1:telnet-server-1:0.17-48.el6 ################################# [100%]
- [atguigu@node001 telnet]$ sudo netstat -tunlp | grep 44444
- tcp6 0 0 127.0.0.1:44444 :::* LISTEN 3139/java
- [atguigu@node001 telnet]$
- [atguigu@node001 telnet]$
- [atguigu@node001 telnet]$
- [atguigu@node001 telnet]$ telnet localhost 44444
- Trying ::1...
- telnet: connect to address ::1: Connection refused
- Trying 127.0.0.1...
- Connected to localhost.
- Escape character is '^]'.
- hello
- OK
- ‘’^Hshidhsidaskdhkasjhdkjshalkdhksjhasjhdjkasd
- OK
- ''
- OK
- 你好,我是xxx,今年xxx岁。
- OK
flume-dir-hdfs.conf
- a3.sources = r3
- a3.sinks = k3
- a3.channels = c3
-
- # Describe/configure the source
- a3.sources.r3.type = spooldir
- a3.sources.r3.spoolDir = /opt/module/flume/flume-1.7.0/uploads
- a3.sources.r3.fileSuffix = .COMPLETED
- a3.sources.r3.fileHeader = true
- #忽略所有以.tmp结尾的文件,不上传
- a3.sources.r3.ignorePattern = ([^ ]*\.tmp)
-
- # Describe the sink
- a3.sinks.k3.type = hdfs
- a3.sinks.k3.hdfs.path = hdfs://node001:8020/flume/upload/%Y%m%d/%H
- #上传文件的前缀
- a3.sinks.k3.hdfs.filePrefix = upload-
- #是否按照时间滚动文件夹
- a3.sinks.k3.hdfs.round = true
- #多少时间单位创建一个新的文件夹
- a3.sinks.k3.hdfs.roundValue = 1
- #重新定义时间单位
- a3.sinks.k3.hdfs.roundUnit = hour
- #是否使用本地时间戳
- a3.sinks.k3.hdfs.useLocalTimeStamp = true
- #积攒多少个Event才flush到HDFS一次
- a3.sinks.k3.hdfs.batchSize = 100
- #设置文件类型,可支持压缩
- a3.sinks.k3.hdfs.fileType = DataStream
- #多久生成一个新的文件
- a3.sinks.k3.hdfs.rollInterval = 600
- #设置每个文件的滚动大小大概是128M
- a3.sinks.k3.hdfs.rollSize = 134217700
- #文件的滚动与Event数量无关
- a3.sinks.k3.hdfs.rollCount = 0
- #最小冗余数
- a3.sinks.k3.hdfs.minBlockReplicas = 1
-
- # Use a channel which buffers events in memory
- a3.channels.c3.type = memory
- a3.channels.c3.capacity = 1000
- a3.channels.c3.transactionCapacity = 100
-
- # Bind the source and sink to the channel
- a3.sources.r3.channels = c3
- a3.sinks.k3.channel = c3
- [atguigu@node001 flume-1.7.0]$ bin/flume-ng agent --conf conf/ --name a3 --conf-file job/enterpriseDevelopmentCases/flume-dir-hdfs.conf
- Info: Sourcing environment configuration script /opt/module/flume/flume-1.7.0/conf/flume-env.sh
- Info: Including Hadoop libraries found via (/opt/module/hadoop/hadoop-3.1.3/bin/hadoop) for HDFS access
- Info: Including HBASE libraries found via (/opt/module/hbase/hbase-2.0.5/bin/hbase) for HBASE access
- [atguigu@node001 hive-3.1.2]$ cd /opt/module/flume/flume-1.7.0/uploads/
- [atguigu@node001 uploads]$ ll
- 总用量 0
- [atguigu@node001 uploads]$ touch 1.txt
- [atguigu@node001 uploads]$ vim 2.txt
- [atguigu@node001 uploads]$ cat 2.txt
- cat: 2.txt: 没有那个文件或目录
- [atguigu@node001 uploads]$ ll
- 总用量 4
- -rw-rw-r-- 1 atguigu atguigu 0 4月 10 15:58 1.txt.COMPLETED
- -rw-rw-r-- 1 atguigu atguigu 22 4月 10 16:00 2.txt.COMPLETED
- [atguigu@node001 uploads]$
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。