无单点故障高性能LAMP集群的构建1无单点故障高性能LAMP集群的构建摘要随着计算机技术的泛的应用,人们对其的依赖程度越来越高,计算机的可靠性和可用性便显得由为重要。尽管单台计算机的性能和可靠性在不断提升,但还是有许多现实要求是单台计算机难以完成的。自从1994年首次采用Beowulf集群以来,集群技术被广泛应用。集群系统在用户面前表现为单一系统映像。连接在网络上的一组PC不具有集群计算机资格,为了构成集群计算机,这些独立PC必须运行可以利用其他计算机的软件,使它们像一个团队那样为了共同的目标协同工作。本文以目前最流行的web框架LAMP(Linux-Apache-MySQL-PHP)为研究对象,提出了一套高可用并且高性能的集群架构。整个架构分为5层,既分发层,web层,共享存储层,代理层和数据库层。层与层之间相互关联,共同对外提供唯一的服务访问入口。论文首先对各层使用到的技术做了概括性的介绍,随后依次进行了展开,分别给出了每层工作原理和实现过程。此后在整个系统上安装PHP论坛,验证了系统能够正常工作,然后与单一架构进行了分析对比,给出了性能测试,测试出其性能有了显著提高。最后,论文提供无单点故障的测试视频,从而验证整个集群的高可用得以实现。关键字:集群,代理,共享存储,数据库无单点故障高性能LAMP集群的构建2TheConstructionofhighavailabilityandhighperformanceLAMPclusterABSTRACTWiththedevelopmentofcomputertechnologyanditswideapplication,ourdependencyonthecomputertechnologybecomesmoreandmorehigh.Computer’sreliabilityandavailabilityarebecomingmoreimportant.Thoughasinglecomputer’scapabilityandreliabilityisbecomingbetter,Butasinglecomputercan’tcompletesomerequeststill.Since1994,thefirstuseofBeowulfclusters,clustertechnologyhasbeenwidelyapplied.Clustersystembehavesasasinglesystemimageinfrontoftheuser.AgroupofPCconnectionsinthenetworkdoesnothavethequalificationofcluster.Inordertoconstituteaclustercomputer,thePCofeachstationmustrunasoftware,whichcanuseothercomputerandmakethemasateam,toacommongoalofmutualsupport.ThepapertakesLAMPwebframework(Linux-Apache-MySQL-PHP)astheresearchobject,putforwardasetofhighavailabilityandhighperformanceclusterarchitecture.Thewholestructureisdividedinto5layers.thedistributionlayer,weblayer,sharedstoragelayer,agentlayer,anddatabaselayer.Thereisacloserelationshipbetweeneachlayer,andtheyprovidesauniqueserviceentrance。Thepaperhasmakeageneralintroductiontothesystem.Thenitintroducestheworkingprincipleofeachlayerandtherealizationoftheprocess.IalsoinstallthePHPforuminthewholesystem,toverifywhetheritcanworknormally,andthengivestestreportoftheperformance,andcomparedwiththesinglearchitecture,testingitsperformanceimprovedsignificantly.Finally,Thispaperprovidesnosinglepointoffailuretestscreen,thusverifyingthewholeclusterhighavailabilityis无单点故障高性能LAMP集群的构建3achieved.Keywords:cluster,proxy,sharestorage,database无单点故障高性能LAMP集群的构建4目录1.绪论.............................................................................................................................................11.1研究背景.......................................................................................................................11.2研究现状.......................................................................................................................11.3研究意义.......................................................................................................................21.4研究内容.......................................................................................................................21.5论文结构.......................................................................................................................41.6本章小结.......................................................................................................................42.负载均衡集群组成的web应用...........................................................................................52.1负载均衡集群技术......................................................................................................52.1.1什么是负载均衡.............................................................................................52.1.2以LVS作为负载均衡器...............................................................................52.2理解LVS的原理..........................................................................................................62.2.1LVSweb应用的体系结构............................................................................62.2.2LVS的负载调度算法.....................................................................................82.3LVS的DR路由方式....................................................................................................92.3.1LVS的地址概念..............................................................................................92.3.1VS-DR直接路由方式...................................................................................102.4关于LVS的一些补充..............................................................................................132.4.1LVS调度算法对服务器的加权.................................................................132.42LVS调度持续性和防火墙标记…………………………………………….132.5LVS负载均衡集群实现概述..................................................................................152.6本章小结.....................................................................................................................173.基于iscsi的共享存储存储层.......................................................................................183.1NAS和SAN...................................................................................................................183.2iscsi技术研究.........................................................................................................19无单点故障高性能LAMP集群的构建53.2.1iscsi的报文格式.................................................................