RedHatEnterpriseLinux5VirtualServerAdministrationLinuxVirtualServer(LVS)forRedHatEnterpriseLinuxVirtualServerAdministrationRedHatEnterpriseLinux5VirtualServerAdministrationLinuxVirtualServer(LVS)forRedHatEnterpriseLinux版5Copyright©2009RedHat,Inc.ThetextofandillustrationsinthisdocumentarelicensedbyRedHatunderaCreativeCommonsAttribution–ShareAlike3.0Unportedlicense(CC-BY-SA).AnexplanationofCC-BY-SAisavailableat®istheregisteredtrademarkofLinusTorvaldsintheUnitedStatesandothercountries.Java®isaregisteredtrademarkofOracleand/oritsaffiliates.XFS®isatrademarkofSiliconGraphicsInternationalCorp.oritssubsidiariesintheUnitedStatesand/orothercountries.MySQL®isaregisteredtrademarkofMySQLABintheUnitedStates,theEuropeanUnionandothercountries.Allothertrademarksarethepropertyoftheirrespectiveowners.1801VarsityDriveRaleigh,NC27606-2072USAPhone:+19197543700Phone:8887334281Fax:+19197543701BuildingaLinuxVirtualServer(LVS)systemoffershighly-availableandscalablesolutionforproductionservicesusingspecializedroutingandload-balancingtechniquesconfiguredthroughthePIRANHA.Thisbookdiscussestheconfigurationofhigh-performancesystemsandserviceswithRedHatEnterpriseLinuxandLVSforRedHatEnterpriseLinux5.iiiIntroductionv1.文档约定.....................................................................................................................vi1.1.排版约定...........................................................................................................vi1.2.抬升式引用约定................................................................................................vii1.3.备注及警告.......................................................................................................vii2.Feedback.....................................................................................................................viii1.Linux虚拟服务器总览11.1.ABasicLVSConfiguration..........................................................................................11.1.1.在真实服务器之间的数据重复和数据共享...........................................................31.2.AThree-TierLVSConfiguration...................................................................................31.3.LVS调度总览...........................................................................................................41.3.1.调度算法.........................................................................................................51.3.2.服务器加权和调度............................................................................................61.4.路由方法....................................................................................................................61.4.1.NAT路由.......................................................................................................61.4.2.直接路由.........................................................................................................71.5.持久性和防火墙标记...................................................................................................91.5.1.持久性............................................................................................................91.5.2.防火墙标记......................................................................................................91.6.LVS—框图............................................................................................................91.6.1.LVSComponents.............................................................................................102.初始LVS配置132.1.在LVS路由器中配置服务.......................................................................................132.2.为PiranhaConfigurationTool设置密码........................................................................142.3.启动PiranhaConfigurationTool服务...........................................................................142.3.1.配置PiranhaConfigurationTool网页服务器端口.................................................152.4.限制对PiranhaConfigurationTool的访问....................................................................152.5.启动数据包转发........................................................................................................162.6.在真实服务器中配置服务...........................................................................................163.设置LVS173.1.NATLVS网络....................................................................