负载均衡开源解决方案_第1页
负载均衡开源解决方案_第2页
负载均衡开源解决方案_第3页
负载均衡开源解决方案_第4页
负载均衡开源解决方案_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Layer4-7,Layer4-7Switch,Schedule,BasicallyHardware/GUI/CLI(Configuremethod)/HA(ConfigSync)Loadbalancerelatedvirtualserver/node/pool/poolmemberMonitorsSorryserverMaintenanceModeLoadbalancemethodPersistenceSNAT/RNATServerProtectionACL/ContentSwitchGSLBPerformance,Wearehere,Basically,LBrelated,Persistence,SNAT/RNAT,ServerProtection,ACL/CS,GSLB,Hardware/GUI/CLI/HA,HAProxyHotReconfiguration,mv/etc/haproxy/config/etc/haproxy/config.oldmv/var/run/haproxy.pid/var/run/haproxy.pid.oldmv/etc/haproxy/config.new/etc/haproxy/configkill-TTOU$(cat/var/run/haproxy.pid.old)ifhaproxy-p/var/run/haproxy.pid-f/etc/haproxy/config;thenechoNewinstancesuccessfullyloaded,stoppingpreviousone.kill-USR1$(cat/var/run/haproxy.pid.old)rm-f/var/run/haproxy.pid.oldexit1elseechoNewinstancefailedtostart,resumingpreviousone.kill-TTIN$(cat/var/run/haproxy.pid.old)rm-f/var/run/haproxy.pidmv/var/run/haproxy.pid.old/var/run/haproxy.pidmv/etc/haproxy/config/etc/haproxy/config.newmv/etc/haproxy/config.old/etc/haproxy/configexit0fi,保存之前状态,停止老的监听,成功,清理老的连接和pid,失败,恢复老的配置,Wearehere,Basically,LBrelated,Persistence,SNAT/RNAT,ServerProtection,ACL/CS,GSLB,Concepts,virtualserver:80,pool(name=cgi_boxes),member(server=:80),member(server=:80),member(server=:80),pool(name=asp_boxes),member(server=:80),member(server=:80),member(server=:80),VIP,virtualserver:443,pool(name=ssl_boxes),member(server=:443),member(server=:443),member(server=:443),VIP,LoadBalancing,IntelligentTrafficControl(lookatURL,clientIPaddr.,etc.),Port-basedTrafficDirection,IPAddr.-basedTrafficDirection,Incomingrequest,MonitorAvailabilityrequirementSNAT/NATPriority-basedmemberactivationACTIONofservicedownSlowRampTimePool/poolmemberstatistics,Monitors,Monitor类型,自定义monitor,HAProxyMonitor,listenwebfarm:80modehttpbalanceroundrobincookieSERVERIDinsertindirectoptionhttpchkHEAD/index.htmlHTTP/1.0serverwebA1:80cookieAcheckserverwebB2:80cookieBcheckport81inter2000serverwebC3:80cookieCcheckserverwebD4:80cookieDcheck,HAProxySorryServer,listenwebfarm:80modehttpbalanceroundrobincookieSERVERIDinsertindirectoptionhttpchkHEAD/index.htmlHTTP/1.0serverwebA1:80cookieAcheckserverwebB2:80cookieBcheckport81inter2000serverwebC3:80cookieCcheckserverwebD4:80cookieDcheckserverbkpA5:80cookieAcheckbackupserverbkpB6:80cookieBcheckbackup,HAProxyMaintenanceMode,Updating.,503ServiceUnavailableNoserverisavailabletohandlethisrequest.,Loadbalancingalgorithm,RoundRobinWrr(Ratio(member),Ratio(Node)DynamicRatio:根据对服务器性能的观察来动态设置weight,观察点包括连接数、响应时间等。Fastest(node)&Fastest(application):服务器/应用的最快响应时间LC(Member)&LC(node)Observed(member)&Observed(node)Predictive(member)&Predictive(node)SourceURLHASHURLParam,Wearehere,Basically,LBrelated,Persistence,SNAT/RNAT,ServerProtection,ACL/CS,GSLB,Persistence,Client,ServerA,pickserver,cookiespecifiesserver,Set-Cookie:SERVERID=A,Cookie:SERVERID=A,Cookiepersistence1.1HTTPCookieInsert1.2HTTPCookieRewrite1.3HTTPCookiePassive1.4CookieHashDestinationAddressaffinitypersistenceHashpersistenceMSRDPpersistenceSIPpersistence(sessionInitiationprotocol)SouceaddressaffnitypersistenceSSLpersistenceUniversalpersistence,insertrewriteprefix,listenwebfarm:80modehttpbalanceroundrobincookieSERVERIDinsertindirectoptionhttpchkHEAD/index.htmlHTTP/1.0serverwebA1:80cookieAcheckserverwebB2:80cookieBcheckserverwebC3:80cookieCcheckserverwebD4:80cookieDcheck,SNAT&RNAT,Externalvlan,Internalvlan,VIP:77,MAPPEDIP:,eth0:,eth1:,SNAT,RNAT,backendprivate#Connecttotheserversusingour00sourceaddresssource00backendtransparent_ssl1#ConnecttotheSSLfarmfromtheclientssourceaddresssource00usesrcclientipserverrailsA1:80source01checkserverrailsB2:80minconn4maxconn12checkserverrailsC3:80minconn4maxconn12check,Wearehere,Basically,LBrelated,Persistence,SNAT/RNAT,ServerProtection,ACL/CS,GSLB,ServerProtection,Attack(SYNFlood)ConnectionLimitTimeoutSurgeQueueSlowStart,listenappfarm:80modehttpmaxconn10000optionhttpcloseoptionabortoncloseoptionforwardforbalanceroundrobinserverrailsA1:80minconn4maxconn12checkserverrailsB2:80minconn4maxconn12checkserverrailsC3:80minconn4maxconn12checkcontimeout60000,weight,maxconn,Timeout,Client,proxy,server,Wearehere,Basically,LBrelated,Persistence,SNAT/RNAT,ServerProtection,ACL/CS,GSLB,HAProxyACL,req_lenwait_endreq_ssl_ver,Layer4andbelow,Layer4Content,methodreq_verpath_*url_*hdr_*,Layer7Content,HTTP_1.1METH_GET,Pre-definedACL,src/dstsrc_port/dst_portdst_connnbsrv(backend),aclmissing_clhdr_cnt(Content-length)eq0blockifHTTP_URL_STAR!METH_OPTIONS|METH_POSTmissing_clblockifMETH_GETHTTP_CONTENTblockunlessMETH_GETorMETH_POSTorMETH_OPTIONS,Toselectadifferentbackendforrequeststostaticcontentsonthewwwsiteandtoeveryrequestontheimg,video,downloadandftphosts:aclurl_staticpath_beg/static/images/img/cssaclurl_staticpath_end.gif.png.jpg.css.jsaclhost_wwwhdr_beg(host)-iwwwaclhost_statichdr_beg(host)-iimg.video.download.ftp.#nowusebackendstaticforallstatic-onlyhosts,andforstaticurls#ofhostwww.Usebackendwwwfortherest.use_backendstaticifhost_staticorhost_wwwurl_staticuse_backendwwwifhost_www,ContentSwitch(UIE/iRule/ACL),frontendpublicreqisetbeHost:imgstatic#TheURIwilluseaspecifickeywordsoonreqisetbe*/(img|css)/staticreqisetbe*/admin/statsstatsdefault_backenddynamic#ThestaticbackendbackendforHost:img,/imgand/css.backendstaticbackenddynamicbackendstats,if(http_uriends_with“.gif”)usepoolimage_serverselseif(http_uristarts_with“/foo”)usepoolfoo_serverselseif(http_cookie(“XYZ-Type”)=“direct”)usepoolcookie_serverselseif(findstr(http_uri,“?type=”,6,“&”)=“cgi”)usepoolcgi_serverselseusepoolweb_servers,aclurl_staticpath_beg/static/images/img/cssaclurl_staticpath_end.gif.png.jpg.css.jsaclhost_wwwhdr_beg(host)-iwwwaclhost_statichdr_beg(host)-iimg.video.download.ftp.use_backendstaticifhost_staticorhost_wwwurl_staticuse_backendwwwifhost_www,Wearehere,Basically,LBrelated,Persistence,SNAT/RNAT,ServerProtection,ACL/CS,GSLB,GSLB,如何实现CDN和站点容灾?!,Illustrated,Performance,Keep-AliveCompressionIn-memoryCacheServerOffloadTCPBuffering,Logging,listenproxy-outmodehttpoptionhttplogoptionlogasaplogglobalservercache1:3128#logthenameofthevirtualservercapturerequestheaderHostlen20#logtheamountofdatauploadedduringaPOSTcapturerequestheaderContent-Lengthlen10#logthebeginningofthereferrercapturerequestheaderRefererlen20#servername(usefulforoutgoingproxiesonly)captureresponseheaderServerlen20#loggingthecontent-lengthisusefulwithoptionlogasapcaptureresponseheaderContent-Lengthlen10#logtheexpectedcachebehaviourontheresponsecaptureresponseheaderCache-Controllen8,HTTPHeaderManipulation,reqdelreqdenyreqpassreqtarpitreqsetbereqisetbereqirepreqidelreqidenyreqipassreqiallowreqitarpitreqaddrsp*,#removeX-Forw

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论