上海交通大学硕士学位论文基于Linux技术的集群计算机存储系统可用性研究姓名:王菁华申请学位级别:硕士专业:计算机技术指导教师:邓倩妮;薜岚20060701LinuxLINUX(LVS)NATVRRPHeartbeat+ldirectordLINUX:LinuxREASEARCHONABILITYOFLINUXSTORAGECLUSTERABSTRACTThemaincontentofthispaperishowtoconstructLinuxHighabilitystoragesystem.Inordertoobtainefficientandreliableservice,thesystemmustresolveproblemofencaplatingip-package,loadbalanceandone-single-failure-pointandstructureofserverprogram.Thepaper,combiningsomeLinuxclusteringtechnologyincludingLVSVRRPHeartbeatandtheothers,designedapracticablestrategy.Forencaplatingip-packageandloadbalance,LVSisusedtobuildahigh-performanceandhighlyavailableserverforLinux,whichprovidesgoodscalability,reliabilityandserviceability.VRRPisaprotocolwhichallowsseveralroutersonamultiaccesslinktoutilizethesamevirtualIPaddress.Slvaerouterwillbeelectedasamasterincaseofthefailureofthemasterrouter,soastoavoideone-single-failure-point.Atthesametime,theloadbalancermonitorserver'sstatuswithHeartbeat+ldirectordtechnologytoinsurethesystem'srobustness.Atthelatterpartofthepaper,describedthetestofresponsespeedaboutdifferentstructureoftheserviceprogram.Thetestresultconfirmdthatestablishsub-processisthebetter.Keyword:Linuxcluster,storagesystem,loadbalance,highabilityone-single-failure-point200688200688200688111.1LinuxLinux1.2LINUXLINUX(HA)(Linuxvirsualserver)2VRRPLVSldirectord1.3Linux[1],,,,.(scalability)CPUCPUVM(SMPsymmetericalmultiprocerssing)CPUSMPCPUCPUSMPCPULINUX1)LINUXPCLinuxPCLinux2)LINUXLINUX3TurbolinuxTurboHAHeartbeatKimberliteWebTurbolinuxClusterServerLinuxVirtualServerPCTurbolinuxEnFusionSCore[2]1.4Linux(LVS)Linux(LVS)Linux(loadbalancer)LVSIP[3]41.4.1LVSLVS1-1LVSFigure1-1ThearchitectureofLVSLVSloadbalancerIPIPSingleEntryPointIPIP5SinglePointofFailureserverpoolWEBMAILFTPDNSWebCacheWEBsharedstorage[3]1.4.2LVSWebCacheMailMediaLVS1.5VRRP(VirtualRouterRedundancyProtocolVRRP)VRRP6VRRPVRRPVRRPVRRPVRRPVRRPIPMACVRRPVRRPVRRPARPIPIPMAC[4]VRRP1-1VRRPTable1-1VRRPProtocolStructure4162432VersionTypeVirtualRtrIDPriorityAuthTypeAdvetIntChecksumIPAddress1``````IPAddressnAuthenticationData1AuthenticationData2LinuxVRRPVRRP1.672Linux3LVS45682LinuxLinuxLinuxSSHNISNFS2.141PC2-1Figure2-1HardwareofCluster2.1.1APACHEWebNFSWebNFSIBM8139IntelXeon2.4GHz1(SMP)512M140GB92(100MNIC)PC:610IntelP3800MHz1256MB20GB1(100MNIC)2.1.22-2Figure2-2topologyofClusternetwork10RS232hostname:tiger.zoo.sheth0:192.168.8.2/24hostname:fox.zoo.sheth0:192.168.0.7/24eth1:192.168.8.17/24hostname:panda.zoo.sheth0:192.168.0.3/24eth1:192.168.8.27/24:192.168.0.5/24hostname:dog.zoo.sheth0:192.168.0.6/242.2REDHAT9SSHNISNFSSLACKWARE92.2.1SSHSSH(SECURESHELL)Telnet[5]SSHDNSIPTelnetSSH11OpenSSHREDHAT9SSH/etc/ssh/ssh_config,2.2.2NISNISNetworkInformationServiceLinux[6]NISNISLinuxNISNISNISNISNISNISmaps[7]NISypservNISNISDomainNISypbind,/etc/nsswitch.confNISNISNIS/etc/passwd,/etc/groupNISNISIPREDHAT9NISNISypbindypwhichypcatyppollypmatchyppasswdypsetNISypservypinityppasswdyppushypxfrnetgroupNIS/var/yq/securenetsNIS/etc/ypserv.confNIS/etc/yp.confNISNIS12ypbindNISFOXNIS1)/var/yp/securenetsNIS[root@fox/]#vi/var/yp/securenes#allowconnectformlocalhostnecessaryhost127.0.0.1#nameas255.255.255.255127.0.0.1##allowconnectfromanyhost255.255.255.0192.168.0.02)portmapperNISportmapperRPC(RemoteProcedureCall)TCP/IPRPCportmapperportmapperNFSportmapperNFSportmapper[root@fox]#/etc/rc.d/init.d/portmapstart[root@fox]#chkconfiglevel35portmapon3)ypservdaemonypservNIS[root@fox]#serviceypservstartStartingYPserverservices:[OK]13rpcinfo:[root@fox]#rpcinfoulocalhostypservNIS1)NISNISypbindNIS/etc/yp.confNISYpsevrver192.168.0.72)/etc/nsswitch.confnis,Passwd:nicfiles3)ypbind2.2.3NFSNFSNetwrokFileSystemSUN1984[8]CD-ROM/etc/exportsrpc.mountdrpc.nfsdrpc.protmapperrpc.mountdrpc.portmapperNFSNFSNFS/etc/exportsNFSNFSmount/etc/fstabNSF1)NFSNFSmountNFSRedHatNIS[root@wolf]#servicenfsstart14NFS[root@wolf]#chkconfiglevel345nfson2)/etc/exports.nfstestexportsnfstest(rw)3)NFSLinuxSSHNISNFSLinux153LinuxLVSLVSLoadBalancer3.1IPVS(IPVS)LVSIPVSLinuxIPVSTCP/UDPIP[9]IPVSIPIP3.1.1IP1)VirtualServerviaNetworkAddressTranslationVS/NAT2)VirtualServerviaIPTunnelingVS/TUN16NATIPVS/TUN3)VirtualServerviaDirectRoutingVS/DRVS/DRMACVS/TUNVS/DRIPIP3.1.2LVSIPIPVSIPLinuxIPTCPUDPIPVS1)RoundRobinSchedulingRoundRobinSchedulingi=(i+1)modni17S={S0,S1,,Sn-1}iW(Si)Siin-1n0j=i;do{j=(j+1)modn;if(W(Sj)0){i=j;returnSi;}}while(j!=i);returnNULL;Round-RobinDNSIPDNSIPVSDNS2)Least-ConnectionSchedulingLeast-ConnectionScheduling118S={S0,S1,...,Sn-1}W(Si)SiC(Si)Sifor(m=0;mn;m++){if(W(Sm)0){for(i=m+1;in;i++){if(W(Si)=0)continue;if(C(Si)C(Sm))m=i;}returnSm;}}returnNULL;TCPTIME_WAITTCPTIME_WAIT2TIME_WAIT3)WeightedLeast-ConnectionSchedulingWeightedLeast-ConnectionScheduling119S={S0,S1,...,Sn-1}W(Si)SiC(Si)SiCSUM=C(Si)(i=0,1,..,n-1)SmSm(C(Sm)/CSUM)/W(Sm)=min{(C(Si)/CSUM)/W(Si)}(i=0,1,.,n-1)W(Si)CSUMC(Sm)/W(Sm)=min{C(Si)/W(Si)}(i=0,1,.,n-1)W(Si)CPULinuxC(Sm)/W(Sm)C(Si)/W(Si)C(Sm)*W(Si)C(Si)*W(Sm)for(m=0;mn;m++){if(W(Sm)0){for(i=m+1;in;i++){if(C(Sm)*W(Si)C(Si)*W(Sm))m=i;}returnSm;}}returnNULL;