,gt
5z
瘪
孑
硕士专业学位论文
基于Spark的数据处理分析系统的设计与实现
Design and Implementation of Data Processing and Analysis System
Based on Spark
作者:李爽
导师:魏小涛副教授
北京交通大学
2015年6月
˝
•
‰
˚
IIIII I IIIII I
II III
Y291 7739
IIII
II
学位论文版权使用授权书
本学位论文作者完全了解北京交通大学有关保留、使用学位论文的规定。特
授权北京交通大学可以将学位论文的全部或部分内容编入有关数据库进行检索,
提供阅览服务,并采用影印、缩印或扫描等复制手段保存、汇编以供查阅和借阅。
同意学校向国家有关部门或机构送交论文的复印件和磁盘。学校可以为存在馆际
合作关系的兄弟高校用户提供文献传递服务和交换服务。
(保密的学位论文在解密后适用本授权说明)
学位论文作者签名: 这旋
签字日期:伽晦年1月/日
导师签名:
签字日期:砂绝年7月f日
˝
•
‰
˚
学校代码:10004
密级:公开
北京交通大学
硕士专业学位论文
基于Spark的数据处理分析系统的设计与实现
Design and Implementation of Data Processing and Analysis System
Based on Spark
作者姓名:李爽
导师姓名:魏小涛
学
职
号:13126098
称:副教授
工程硕士专业领域:软件工程
学位级别:硕士
北京交通大学
2015年6月
˝
•
‰
˚
致谢
本论文的工作是在我的导师魏小涛教授的悉心指导下完成的,魏老师严谨的
治学态度和科学的工作方法给了我极大的帮助和影响。本论文历经数次修改,每
次提交后老师都会通篇仔细阅读,小到常见的错别字都会一一指出。在此衷心感
谢感谢魏老师两年来对我的关心和指导。
感谢实习公司的领导和同事,他们在我实习期间给予我无私的帮助,也给了
我很多有益的建议,让我迅速成长。
最后也要感谢我的家人,他们的理解和支持使我能够在学校专心完成我的学
业。家人在我的求学之路上始终作为我最坚强的后盾,不断鼓励我,宽容我。希
望他们永远都能健康快乐。
˝
•
‰
˚
摘要
摘要
随着计算机和信息技术的迅猛发展和普及应用,行业应用系统的规模迅速扩
大,行业应用所产生的数据呈爆炸性增长。寻求有效的大数据处理技术、方法和
手段已经成为现实世界的迫切需求。Hadoop和Spark是FI前最流行的分布式计算
框架,随着相关技术的逐渐成熟,现在很多公司都在研究学习,以满足自身业务
的需求和提高产品的品质。在此背景下,某公司提出基于Spark来开发一个用于数
据处理分析的系统,即ATL.DPAS(Data Processing and Analysis System Of Acn
Technology Lab)。该系统不仅能够兼容Hadoop集群,而且能够利用现有的计算资
源灵活高效的处理海量数据、进行交互式实时查询、进行可视化智能分析。
根据不同的功能需求,系统划分为数据处理模块、数据查询模块、数据建模
模块。本人主要负责数据处理模块的设计与开发,包括设计数据处理模块的流程、
设计与实现数据清洗合并算法、实现各种数据处理方式的接口等。本论文中,首
先对ATL数据处理分析系统的研究现状进行了综述,简单介绍了相关理论与技术;
其次从功能性需求和非功能性需求两方面对系统需求进行了分析,从中梳理出系
统目标,确定了系统总体设计架构,也对系统数据库进行了详细设计:再次,针
对数据处理模块中HDFS列表、数据添加、数据清洗、数据合并、数据类型管理
五个子模块进行了流程设计、代码实现与界面展示;最后介绍了系统部署的过程
和系统测试的方法,对数据处理模块进行了详细的功能测试和性能测试,并对测
试结果进行分析评估,从而验证了Spark数据处理方面的出色性能,也证明了本文
工作的有效性和实用性。
目前,该系统正处在试运行阶段,每天有百G数量级的数据进行处理分析。
运行结果表明,系统完全能够正常运行且性能优良,达到了预期目标。
关键词:大数据;数据处理;Spark;HDFS;Hive
˝
•
‰
˚
ABSTRACT
AB STRACT
Application systems expansion magically wim the rapid growth of computer and
information technology,at the same time,the quality of data that come from the
application systems increase explosively.It is necessary and urgent to find effective
technology and rules right now.In modem world,Hadoop and Spark are the most
popular distributed computing framework.For the purpose of meet their business
requirement and improve quality of their products,increasing number of companies and
institutions began to leam and use these two technologies which have gradually matured.
In this context,a company puts forward to build a data processing analysis system based
on Spark.namely ATL—DPAS(data processing and analysis system of acn technology
lab).This system could not only compatible with Hadoop cluster,but also flexibly
process the numerable data,take real-time remote inquiry and visual analysis according
to the existing computing resources.
According to different functional requirements,this system is divided into three
modules which include data processing module,data query module and data modeling
module.I Was primarily responsible for the design and development of data processing
module,including the design of flow,the design and implementation of data cleaning or
merging algorithm,and to implement a variety of data processing interface.In this paper,
firstly the research status of ATL data processing and analysis system is reviewed,then
this paper introduces the related theory and technology.Secondly,in order to tease out
aims of this system,this paper describes the system requirements analysis,including
functional requirements and non—functional requirements.Then introduces system
architecture design and database design.Thirdly,accomplishs flow design,code
realization and interface display for data processing module which includes HDFS list,
data adding,data cleaning,data combining and data type management.Finally,
introduces the process of system deployment and the way of system test.Then describes
detailedly function test and performance test of data processing module,and evaluates
the test results.So as to confirm the excellent performance of Spark,also proves the
validity and practicability of this paper.
At present,this system is in the stage of trial operation,there ale hundreds of G
level data is processed and analyzed every day.The operation results show that the
system Can run with excellent performances and stable operation,and it achieves the
˝
•
‰
˚
ABSTRACT
desired objectives.
KEYWORDS:Big data;Data processing;Spark;HDFS;Hive
˝
•
‰
˚
目录
目录
摘要………………………………………………………………………………..v
ABSTRACT…......….......………......………………………………....….……........……….......vii
1 引言……………………………………………………………………………1
1.1研发背景………………………………………………………………….1
1.2项目来源………………………………………………………………….2
1.3项目研发的意义………………………………………………………….2
1.4本人在项目中的工作…………………………………………………….3
1.5本文研究内容与组织结构……………………………………………….3
2相关理论与技术介绍…………………………………………………………5
2.1
2.2
2.3
HDFS……………………………………………………………………………………………..5
Hive….......…......…………………........….…......…….......………......…….........……7
Spark………………………………………………………………………………………………8
2.3.1
Spark体系结构………………………………………………………8
2.3.2
Spark应用开发………………………………………………………9
2.4本章小结…………………………………………………………………12
3系统需求分析………………………………………………………………~13
3.1 系统概述…………………………………………………………………13
3.2功能性需求………………………………………………………………14
3.2.1数据处理……………………………………………………………14
3.2.2数据查询分析………………………………………………………15
3.2.3数据建模分析………………………………………………………16
3.3非功能性需求……………………………………………………………17
3.3.1性能需求……………………………………………………………17
3.3.2易用性………………………………………………………………17
3.3.3 安全性………………………………………………………………18
3.3.4可扩展性……………………………………………………………1 8
3.4本章小结…………………………………………………………………18
4系统概要设计………………………………………………………………..19
4.1系统总体设计架构………………………………………………………19
˝
•
‰
˚