网站cms管理后台电话号码,网站软件开发,常州知名网站建设公司,南昌集团制作网站开发【尚硅谷】大数据技术之Flume教程从入门到实战_哔哩哔哩_bilibili 目录
flume简介
flume案例
1、监控端口数据官方案例
2、实时读取目录文件到HDFS案例 flume简介 Flume是Cloudera提供的一个高可用的#xff0c;高可靠的#xff0c;分布式的海量日志采集、聚合和传输的系… 【尚硅谷】大数据技术之Flume教程从入门到实战_哔哩哔哩_bilibili 目录
flume简介
flume案例
1、监控端口数据官方案例
2、实时读取目录文件到HDFS案例 flume简介 Flume是Cloudera提供的一个高可用的高可靠的分布式的海量日志采集、聚合和传输的系统。Flume基于流式架构灵活简单。 flume案例
1、监控端口数据官方案例 [atguigunode001 flume-1.7.0]$ bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-telnet-logger.conf -Dflume.root.loggerINFO,console [atguigunode001 ~]$ cd /opt/software/telnet
[atguigunode001 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
[atguigunode001 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%]
[atguigunode001 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%]
[atguigunode001 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%]
[atguigunode001 telnet]$ sudo netstat -tunlp | grep 44444
tcp6 0 0 127.0.0.1:44444 :::* LISTEN 3139/java
[atguigunode001 telnet]$
[atguigunode001 telnet]$
[atguigunode001 telnet]$
[atguigunode001 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
OKOK
你好我是xxx今年xxx岁。
OK
2、实时读取目录文件到HDFS案例 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
[atguigunode001 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
[atguigunode001 hive-3.1.2]$ cd /opt/module/flume/flume-1.7.0/uploads/
[atguigunode001 uploads]$ ll
总用量 0
[atguigunode001 uploads]$ touch 1.txt
[atguigunode001 uploads]$ vim 2.txt
[atguigunode001 uploads]$ cat 2.txt
cat: 2.txt: 没有那个文件或目录
[atguigunode001 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
[atguigunode001 uploads]$