Flume 的安装与使用

flume安装与配置 1.解压 命名 tar zxvf /opt/apache-flume-1.6.0-bin.tar.gz -C /opt [root@master ~]#cd /opt/ [root@master ~]#mv apache-flume-1.6.0-bin/ flume 2.vi /etc/profile [root@master ~]#vi /etc/profile # 编辑系统环境变量配置文件 # set flume environment export FLUME_HOME=/usr 阅读详情

安装步骤

  1. Flume安装地址
1) Flume官网地址
http://flume.apache.org/
2)文档查看地址
http://flume.apache.org/FlumeUserGuide.html
3)下载地址
http://archive.apache.org/dist/flume/
  1. 安装部署
1)将apache-flume-1.7.0-bin.tar.gz上传到linux的/opt/software目录下
2)解压apache-flume-1.7.0-bin.tar.gz到/opt/module/目录下
	[root@hadoop102 software]$ tar -zxvf apache-flume-1.7.0-bin.tar.gz -C /opt/module/
3)修改apache-flume-1.7.0-bin的名称为flume
	[root@hadoop102 software]$ mv apache-flume-1.7.0-bin flume
4)将flume/conf下的flume-env.sh.template文件修改为flume-env.sh,并配置flume-env.sh文件
	[root@hadoop102 conf]$ mv flume-env.sh.template flume-env.sh
	[root@hadoop102 conf]$ vim flume-env.sh
	export JAVA_HOME=/opt/module/jdk1.8.0_144

案例实操

  1. Flume实时读取目录中文件到HDFS
    案例需求:实时监控Hive日志,并上传到HDFS中
创建一个文件
[root@hadoop102 job]$ touch flume-dir-hdfs.conf
打开文件
[root@hadoop102 job]$ vim 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/upload
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://hadoop101:9000/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 = 30
#设置每个文件的滚动大小大概是128M
a3.sinks.k3.hdfs.rollSize = 134217700
#文件的滚动与Event数量无关
a3.sinks.k3.hdfs.rollCount = 0

# 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

各个参数的解释2)执行监控配置

[root@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a2 --conf-file job/flume-file-hdfs.conf

3)开启hadoop和hive并操作hive产生日志

[root@hadoop102 hadoop-2.7.2]$ sbin/start-dfs.sh
[root@hadoop102 hadoop-2.7.2]$ sbin/start-yarn.sh

[root@hadoop102 hive]$ bin/hive
  1. 单数据源多出口案例
1)案例需求:使用flume-1监控文件变动,flume-1将变动内容传递给flume-2,flume-2负责存储到HDFS。同时flume-1将变动内容传递给flume-3,flume-3负责输出到local filesystem。
2)实现步骤:
在job目录下创建group1文件夹
[root@hadoop102 job]$ cd group1/
在/opt/module/datas/目录下创建flume3文件夹
[root@hadoop102 datas]$ mkdir flume3

1.创建flume-file-flume.conf
	配置1个接收日志文件的source和两个channel、两个sink,分别输送给flume-flume-hdfs和flume-flume-dir。
创建配置文件并打开
[root@hadoop102 group1]$ touch flume-file-flume.conf
[root@hadoop102 group1]$ vim flume-file-flume.conf
添加如下内容
# Name the components on this agent
a1.sources = r1
a1.sinks = k1 k2
a1.channels = c1 c2
# 将数据流复制给多个channel
a1.sources.r1.selector.type = replicating

# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /opt/module/hive/logs/hive.log
a1.sources.r1.shell = /bin/bash -c

# Describe the sink
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = hadoop102
a1.sinks.k1.port = 4141

a1.sinks.k2.type = avro
a1.sinks.k2.hostname = hadoop102
a1.sinks.k2.port = 4142

# Describe the channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

a1.channels.c2.type = memory
a1.channels.c2.capacity = 1000
a1.channels.c2.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1 c2
a1.sinks.k1.channel = c1
a1.sinks.k2.channel = c2

注:Avro是由Hadoop创始人Doug Cutting创建的一种语言无关的数据序列化和RPC框架。
注:RPC(Remote Procedure Call)—远程过程调用,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议。
2.创建flume-flume-hdfs.conf
配置上级flume输出的source,输出是到hdfs的sink。
创建配置文件并打开
[root@hadoop102 group1]$ touch flume-flume-hdfs.conf
[root@hadoop102 group1]$ vim flume-flume-hdfs.conf

添加如下内容
# Name the components on this agent
a2.sources = r1
a2.sinks = k1
a2.channels = c1

# Describe/configure the source
a2.sources.r1.type = avro
a2.sources.r1.bind = hadoop102
a2.sources.r1.port = 4141

# Describe the sink
a2.sinks.k1.type = hdfs
a2.sinks.k1.hdfs.path = hdfs://hadoop101:9000/flume2/%Y%m%d/%H
#上传文件的前缀
a2.sinks.k1.hdfs.filePrefix = flume2-
#是否按照时间滚动文件夹
a2.sinks.k1.hdfs.round = true
#多少时间单位创建一个新的文件夹
a2.sinks.k1.hdfs.roundValue = 1
#重新定义时间单位
a2.sinks.k1.hdfs.roundUnit = hour
#是否使用本地时间戳
a2.sinks.k1.hdfs.useLocalTimeStamp = true
#积攒多少个Event才flush到HDFS一次
a2.sinks.k1.hdfs.batchSize = 100
#设置文件类型,可支持压缩
a2.sinks.k1.hdfs.fileType = DataStream
#多久生成一个新的文件
a2.sinks.k1.hdfs.rollInterval = 600
#设置每个文件的滚动大小大概是128M
a2.sinks.k1.hdfs.rollSize = 134217700
#文件的滚动与Event数量无关
a2.sinks.k1.hdfs.rollCount = 0
#最小冗余数
a2.sinks.k1.hdfs.minBlockReplicas = 1

# Describe the channel
a2.channels.c1.type = memory
a2.channels.c1.capacity = 1000
a2.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a2.sources.r1.channels = c1
a2.sinks.k1.channel = c1


3.创建flume-flume-dir.conf
配置上级flume输出的source,输出是到本地目录的sink。
创建配置文件并打开
[root@hadoop102 group1]$ touch flume-flume-dir.conf
[root@hadoop102 group1]$ vim flume-flume-dir.conf
添加如下内容
# Name the components on this agent
a3.sources = r1
a3.sinks = k1
a3.channels = c2

# Describe/configure the source
a3.sources.r1.type = avro
a3.sources.r1.bind = hadoop102
a3.sources.r1.port = 4142

# Describe the sink
a3.sinks.k1.type = file_roll
a3.sinks.k1.sink.directory = /opt/module/datas/flume3

# Describe the channel
a3.channels.c2.type = memory
a3.channels.c2.capacity = 1000
a3.channels.c2.transactionCapacity = 100

# Bind the source and sink to the channel
a3.sources.r1.channels = c2
a3.sinks.k1.channel = c2

提示:输出的本地目录必须是已经存在的目录,如果该目录不存在,并不会创建新的目录。
4.执行配置文件
分别开启对应配置文件:flume-flume-dir,flume-flume-hdfs,flume-file-flume。
[root@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a3 --conf-file job/group1/flume-flume-dir.conf
[root@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a2 --conf-file job/group1/flume-flume-hdfs.conf
[root@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a1 --conf-file job/group1/flume-file-flume.conf

5.启动hadoop和hive
[root@hadoop102 hadoop-2.7.2]$ sbin/start-dfs.sh
[root@hadoop102 hadoop-2.7.2]$ sbin/start-yarn.sh
[root@hadoop102 hive]$ bin/hive
hive (default)>

6.检查HDFS上数据

7检查/opt/module/datas/flume3目录中数据
[root@hadoop102 flume3]$ ll
总用量 8
-rw-rw-r--. 1 root root 5942 5月  22 00:09 1526918887550-3
  1. 多数据源汇总案例
    1)案例需求:
    hadoop102上的flume-1监控文件hive.log,
    hadoop103上的flume-2监控某一个端口的数据流,
    flume-1与flume-2将数据发送给hadoop102上的flume-3,flume-3将最终数据打印到控制台
0.准备工作
分发flume
[root@hadoop102 module]$ scp flume
	在hadoop102、hadoop103以及hadoop104的/opt/module/flume/job目录下创建一个group2文件夹
[root@hadoop102 job]$ mkdir group2
[root@hadoop102 job]$ mkdir group2
[root@hadoop103 job]$ mkdir group2
1.创建flume1.conf
配置source用于监控hive.log文件,配置sink输出数据到下一级flume。
在hadoop102上创建配置文件并打开
[root@hadoop102 group2]$ touch flume-file.conf
[root@hadoop102 group2]$ vim flume-file.conf 
添加如下内容
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /opt/module/hive/logs/hive.log
a1.sources.r1.shell = /bin/bash -c

# Describe the sink
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = hadoop102
a1.sinks.k1.port = 4141

# Describe the channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
2.创建flume2.conf
配置source监控端口44444数据流,配置sink数据到下一级flume:
在hadoop104上创建配置文件并打开
[root@hadoop103 group2]$ touch flume2.conf
[root@hadoop103 group2]$ vim flume2.conf
添加如下内容
# Name the components on this agent
a2.sources = r1
a2.sinks = k1
a2.channels = c1

# Describe/configure the source
a2.sources.r1.type = netcat
a2.sources.r1.bind = hadoop102
a2.sources.r1.port = 44444

# Describe the sink
a2.sinks.k1.type = avro
a2.sinks.k1.hostname = hadoop102
a2.sinks.k1.port = 4141

# Use a channel which buffers events in memory
a2.channels.c1.type = memory
a2.channels.c1.capacity = 1000
a2.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a2.sources.r1.channels = c1
a2.sinks.k1.channel = c1
3.创建flume3.conf
配置source用于接收flume1与flume2发送过来的数据流,最终合并后sink到控制台。
在hadoop102上创建配置文件并打开
[root@hadoop102 group2]$ touch flume3.conf
[root@hadoop102 group2]$ vim flume3.conf
添加如下内容
# Name the components on this agent
a3.sources = r1
a3.sinks = k1
a3.channels = c1

# Describe/configure the source
a3.sources.r1.type = avro
a3.sources.r1.bind = hadoop102
a3.sources.r1.port = 4141

# Describe the sink
# Describe the sink
a3.sinks.k1.type = logger

# Describe the channel
a3.channels.c1.type = memory
a3.channels.c1.capacity = 1000
a3.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a3.sources.r1.channels = c1
a3.sinks.k1.channel = c1
4.执行配置文件
分别开启对应配置文件:flume3.conf,flume2.conf,flume1.conf。
[root@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a3 --conf-file job/group2/flume3.conf -Dflume.root.logger=INFO,console
[root@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a2 --conf-file job/group2/flume2.conf
[root@hadoop103 flume]$ bin/flume-ng agent --conf conf/ --name a1 --conf-file job/group3/flume-file.conf 
5.在hadoop102上向/opt/module目录下的group.log追加内容
[root@hadoop102 module]$ echo 'hello' > group.log
6.在hadoop103上向44444端口发送数据
[root@hadoop103 flume]$ telnet hadoop104 44444
7.  检查数据
Flume安装配置 本任务需要使用root用户完成相关配置,已安装Hadoop及需要配置前置环境,具体要求如下: 阅读详情

相关推荐

Apache-flume-1.7.0-bin.tar.gz

apache旗下组件flume,用于数据的采集,主要包括数据的source、channel以及sink,提供1.7.0稳定版本

kali安装maven和jdk、解决:bash: mvn: command not found

0x00安装、配置maven 1、安装 wget 命令 #yum -y install wget 2、下载maven安装包 #wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz 3.解压maven安装包 #tar -zxvf apache-maven-3.5.4-bin.tar.gz 4.配置maven mvn ,根据自己的包路径修改一下 #update-alter

召唤大白的博客 3108

apache-flume-1.9.0-bin.tar.gz

编译好的flume1.9.0,下载安装即可使用

Flume 安装

官方网站:http://flume.apache.org/ 用户文档:http://flume.apache.org/FlumeUserGuide.html 开发文档:http://flume.apache.org/FlumeDeveloperGuide.html 安装部署 1 将apache-flume-1.7.0-bin.tar.gz上传到linux的/opt/software目录下 2 解压...

小杨的技术博客 2万+

apache-flume-1.7.0-bin.tar.zip

apache-flume-1.7.0-bin.tar.zip,解压后是tar包

apache-flume-1.7.0-bin.tar.gz

自动化采集工具开发包,需要的童鞋自取

分布式集群安装flume1.7.0版本最细教程

1.首先启动Zookeeper和hadoop集群,然后先启动主节点上的flume(如果先启动slave上的会导致拒绝连接)3.启动成功后,在从节点hadoop002的usr/tmp文件夹下新建某个test文件,随便写些内容。1.在第二个节点上conf文件夹下创建一个新的hadoop002.conf文件。在主节点的flume的conf文件夹下创建一个hadoop001.conf文件。一定要先启动主节点,再启动从节点!2.再启动两个从节点上的flume。3.修改主节点中flume的配置。

socall_me_maybe的博客 798

apache-flume-1.9.0-bin.tar.zip

apache-flume-1.9.0-bin.tar.zip apache-flume-1.9.0-bin.tar.zip apache-flume-1.9.0-bin.tar.zip

Flume的安装和使用

hdfs.filePrefix = log_%Y%m%d_%H 如:log_20151016_13.1444973768543。# 将/usr/local/flume/tmpData下的文本文件上传到hdfs://node10:9000/test/# Event的headers增加文件名如:headers:{basename=a.txt}每个文件读取完之后,修改后缀为.COMPLETED,重启flume时忽略这些文件。#设置Kafka的broker地址和端口号。#设置Kafka的Topic。

weixin_42795092的博客 1253

Matplotlib图片尺寸调整全攻略:从figsize到savefig的实战技巧

在数据可视化与科学计算中,图形尺寸控制是影响图表可读性与专业度的基础环节。其核心原理在于协调逻辑尺寸(英寸)与物理输出(像素)的映射关系,这直接决定了信息呈现的清晰度与布局合理性。从技术价值看,精准的尺寸控制能提升图表在不同媒介(如学术论文、报告、网页)中的适配性,避免显示不全、模糊失真等常见问题。在应用场景上,无论是Jupyter Notebook中的交互探索、自动化报告的批量生成,还是满足严格出版要求的插图制作,都需要掌握对应的尺寸调整策略。本文聚焦于matplotlib中的figsize参数、rcPa

weixin_30899023的博客 342

Python-编写点云处理软件(二)点云软件ui制作之仿CC界面

至本篇结束,我们已经能够获得一个有点模子的界面了,但是具体的功能还没有编写,后续的文章将逐渐完善功能。

weixin_43894929的博客 3959

Flume安装及部署

今天给大家分享一下Flume单机配置以及安装部署 一、下载和上传flume(两种方式) 1、手动下载 1.1 http://mirror.bit.edu.cn/apache/flume/1.8.0/ 下载flume 1.2 随便找一个目录 创建一个flume文件夹 我的在/kingyifan目录 命令:mkdir flume 1.3 把flume安装包上传服...

猿码优创 9471

ZED双目相机环境配置

ZED SDK 安装文件夹中有一个 Python 脚本(get_python_api.py),可以自动检测操作系统、CUDA 和 Python 版本并下载相应的预编译 Python API 包(pyzed)。安装SDK成功后,我们进入ZED SDK文件夹中的tools子文件夹,运行ZED Explorer.exe 以及 ZED Depth Viewer.exe,查看ZED相机是否能正常启用工作。在本例中,我们简单地检索ZED相机的序列号:打开 ZED相机,然后打印其序列号,然后关闭相机。

qq_53545309的博客 2174

Flume的安装及使用

​ -Dflume.root.logger=INFO,console 表示flume运行时动态修改flume.root.logger参数属性值,并将控制台日志打印级别设置为INFO级别 ,日志级别包括: log、info、warn、 error。​ Flume1监控文件内容变动,将监控到的内容分别给到flume2和flume3,flume2将内容写到HDFS, Flume3将数据写到本地文件系统。​ -f 表示flume启动读取的配置文件。启动hive,之后查看HDFS。

qzq021226的博客 2393

深度学习实战102-基于深度学习的网络入侵检测系统,利用各种AI模型和pytorch框架实现网络入侵检测

在明确了研究背景后,我们需要设定明确的项目目标。本项目的核心目标是开发一个高精度、低延迟的网络入侵检测系统检测准确率:达到95%以上,确保系统能够有效识别各类已知和未知的入侵行为。响应时间:控制在毫秒级范围内,以实现实时监测和快速响应。模型鲁棒性:在面对不同类型的网络环境和攻击手法时,系统需保持稳定的性能输出。可扩展性:系统设计需考虑未来可能面临的新型威胁,便于后续升级和维护。

微学AI的博客 1797

基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的体育赛事目标检测系统(Python+PySide6界面+训练代码)

本文详细介绍了一个基于YOLOv5/v6/v7/v8的体育赛事目标检测系统的设计与实现。系统采用先进的深度学习算法,结合PySide6图形界面,实现了对体育赛事中运动员、球类、裁判等多种目标的实时检测与跟踪。本文将全面阐述系统的架构设计、算法原理、训练流程、界面实现以及实际应用效果,并提供完整的代码实现。

YOLO 513

Flume的安装

下载及安装 1.Flume 到Flume官网上http://flume.apache.org/download.html下载软件安装包,如图:下载、解压 tar -xzf flume-1.5.2-bin.tar.gz cp -r apache-flume-1.5.2-bin /usr/local 2.jdk1.8的安装 1.到jdk官网http://www.oracle.com/technetwork/java/javase/downloads/index.html下载软件安装包,如图: .

mocas_wang的博客 627

C++从入门到进阶的系列书籍推荐(22本书)

要多读书,读好书!一本书要多读几遍才好,每次都可能有新的收获!特别在是有一定的工作年限和工作经验之后!读书百遍,其义自见! 下面就给大家推荐一下C++程序员进阶需要读的经典书籍: 1、C++入门书籍 C++是在C语言的基础上发展而来的,要学习C++之前需要先学习C语言。有了C语言基础之后再去学习C++。 1.1、C语言程序设计(谭浩强) 该书被公认为学习C语言程序设计的优秀教材,被全国大多数高校选用,是学习C语言的主流用书。本书比较通俗易懂,是初入者必备的书籍。 ........

dvlinker的技术专栏 4万+

Flume的安装与使用方法

一:安装flume flume下载地址: [flume下载官网] 通过SSH工具将flume文件从window系统发送到Ubuntu中,如下图。 1.解压安装包 cd ~ cd 下载 sudo tar -zxvf apache-flume-1.9.0-bin.tar.gz -C /usr/local # 将apache-flume-1.9.0-bin.tar.gz解压到/usr/local目录下,这里一定要加上-C否则会出现归档找不到的错误 cd /usr/local sudo mv ./apa

码农阿益的博客 4万+

C++ int转四字节数组

字节转换

我不是码农的博客~~~ 978

关于DEJA_VU3D - Cesium功能集专栏说明

专栏主要目的是对工作中基于Cesium实现过的功能进行整合,暂时打算一周2-3更的样子来更新,每一篇都会奉上完整源代码(尽可能把代码简洁一些)。功能实现大多数是自己琢磨实现的,也有参考其他大神后整理实现的,初步算了算现在有差不多实现小130个左右的功能,后续也会不断的更新。..........................................

总得学点什么的博客 2万+

Flume安装

安装telnet服务和客户端 #安装telnet服务 yum install telnet-server #安装客户端 yum install telnet.* 安装包连接 链接: flume 提取码: xyrp 安装flume 将安装包拖入linux系统中 解压到指定目录 tar -zxvf flume-ng-1.6.0-cdh5.14.0.tar.gz -C /opt/soft/ 给解压文件改名 mv apache-flume-1.6.0-cdh5.14.0-bin/ flume 去解压目录

lyq7269的博客 776

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

[ 安装 ] Flume安装步骤!

Hive安装步骤一、准备工作二、安装步骤(一)解压(二)配置驱动(三)环境变量配置(四)Jar 包拷贝   前言:下文中的IP地址、文件路径、主机名等,请根据您自己的实际情况,进行修改和配置。 flume-ng-1.6.0-cdh5.14.2.tar.gz 下载链接 提取码:33u0 一、准备工作 安装一台虚拟机(★★★ 虚拟机 CentOS 7的安装步骤 ★★★) 启动一台虚拟机,并连接至Xshell、Xftp(连接方法) 安装、搭建好JDK、MySQL、Hadoop,并做

且陶陶。 1万+

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

Flume的安装与使用

分享了flume的安装与使用

xieyichun_的博客 1464

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

在Windows下的flume 安装,部署及和kafka组合使用

一,Windows下配置环境变量 此电脑->右键属性->系统->高级系统设置->环境变量 (1) 环境变量名:FLUME_HOME 变量值:就是安装的flume的路径 例如我自己的是:FLUME_HOME;E:\flume\apache-flume-1.9.0-bin (2)在path变量中添加 %FLUME_HOME%\conf;%FLUME_HOME%\bin;然后依次保存我们所做的修改即可。编辑apache-flume-1.9.0-bin\conf 下的flu..

hhjdshz的博客 8884
上一篇: hive的排序以及常用的一些函数
下一篇: hive的问题汇总以及问题解析
qq_42078469
博客等级 码龄9年 7粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值