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

下载本文档

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

文档简介

Layer4-7Layer4-7SwitchScheduleBasicallyHardware/GUI/CLI(Configuremethod)/HA(ConfigSync)Loadbalancerelatedvirtualserver/node/pool/poolmemberMonitorsSorryserverMaintenanceModeLoadbalancemethodPersistenceSNAT/RNATServerProtectionACL/ContentSwitchGSLBPerformanceWearehereBasicallyLBrelatedPersistenceSNAT/RNATServerProtectionACL/CSGSLBHardware/GUI/CLI/HAHAProxyHotReconfigurationmv/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;thenecho"Newinstancesuccessfullyloaded,stoppingpreviousone."kill-USR1$(cat/var/run/haproxy.pid.old)rm-f/var/run/haproxy.pid.oldexit1elseecho"Newinstancefailedtostart,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失败,恢复老的配置WearehereBasicallyLBrelatedPersistenceSNAT/RNATServerProtectionACL/CSGSLBConceptsvirtualserver

:80pool(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

:443pool(name=ssl_boxes)member(server=:443)member(server=:443)member(server=:443)VIP

Load

BalancingIntelligent

TrafficControl

(lookatURL,clientIPaddr.,etc.)Port-based

TrafficDirectionIPAddr.-based

TrafficDirectionIncomingrequestMonitorAvailabilityrequirementSNAT/NATPriority-basedmemberactivationACTIONofservice

downSlowRampTimePool/pool

member

statistics大家有疑问的,可以询问和交流可以互相讨论下,但要小声点MonitorsMonitor类型自定义monitorHAProxyMonitor

listenwebfarm:80modehttpbalanceroundrobincookieSERVERIDinsertindirect

optionhttpchkHEAD/index.htmlHTTP/1.0serverwebA1:80cookieAcheckserverwebB2:80cookieBcheckport81inter2000serverwebC3:80cookieCcheckserverwebD4:80cookieDcheckHAProxySorryServerlistenwebfarm:80modehttpbalanceroundrobincookieSERVERIDinsertindirectoptionhttpchkHEAD/index.htmlHTTP/1.0serverwebA1:80cookieAcheckserverwebB2:80cookieBcheckport81inter2000serverwebC3:80cookieCcheckserverwebD4:80cookieDcheckserverbkpA5:80cookieAcheckbackupserverbkpB6:80cookieBcheckbackupHAProxyMaintenanceModeUpdating...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)SourceURLHASHURLParamWearehereBasicallyLBrelatedPersistenceSNAT/RNATServerProtectionACL/CSGSLBPersistenceClientServerAGET/URI1HTTP/1.1

HTTPrequest(nocookie)TCPhandshakeTCPhandshakeGET/URI1HTTP/1.1

HTTPrequest(nocookie)HTTP/1.1200OK

HTTPreply(nocookie)HTTP/1.1200OKHTTPreply(withinsertedcookie)pick

serverGET/URI2HTTP/1.1

HTTPrequest(withsamecookie)TCPhandshakeTCPhandshakeGET/URI2HTTP/1.1

HTTPrequest(withsamecookie)HTTP/1.1200OK

HTTPreply(nocookie)HTTP/1.1200OK

HTTPreply(updatedcookie)cookie

specifies

serverFirstHitSecondHitSet-Cookie:SERVERID=ACookie:SERVERID=ACookiepersistence1.1HTTPCookieInsert1.2HTTPCookieRewrite1.3HTTPCookiePassive1.4CookieHashDestinationAddressaffinitypersistenceHashpersistenceMSRDPpersistenceSIPpersistence(sessionInitiationprotocol)SouceaddressaffnitypersistenceSSLpersistenceUniversalpersistenceinsertrewriteprefixlistenwebfarm:80modehttpbalanceroundrobincookieSERVERIDinsertindirectoptionhttpchkHEAD/index.htmlHTTP/1.0serverwebA1:80cookieAcheckserverwebB2:80cookieBcheckserverwebC3:80cookieCcheckserverwebD4:80cookieDcheckSNAT&RNATExternalvlanInternalvlanVIP:77MAPPEDIP:eth0:eth1:SNATRNATbackendprivate#Connecttotheserversusingour00sourceaddresssource00backendtransparent_ssl1#ConnecttotheSSLfarmfromtheclient'ssourceaddress

source00usesrcclientipserverrailsA1:80source01checkserverrailsB2:80minconn4maxconn12checkserverrailsC3:80minconn4maxconn12checkWearehereBasicallyLBrelatedPersistenceSNAT/RNATServerProtectionACL/CSGSLBServerProtectionAttack(SYNFlood)ConnectionLimitTimeoutSurgeQueueSlowStartlistenappfarm:80modehttpmaxconn10000optionhttpcloseoptionabortoncloseoptionforwardforbalanceroundrobinserverrailsA1:80minconn4maxconn12checkserverrailsB2:80minconn4maxconn12checkserverrailsC3:80minconn4maxconn12checkcontimeout60000weightmaxconnTimeoutClientproxyserverWearehereBasicallyLBrelatedPersistenceSNAT/RNATServerProtectionACL/CSGSLBHAProxyACLreq_lenwait_endreq_ssl_verLayer4andbelowLayer4Contentmethodreq_verpath_*url_*hdr_*Layer7ContentHTTP_1.1METH_GET…Pre-definedACLsrc/dstsrc_port/dst_portdst_connnbsrv(backend)aclmissing_clhdr_cnt(Content-length)eq0blockifHTTP_URL_STAR!METH_OPTIONS||METH_POSTmissing_clblockifMETH_GETHTTP_CONTENTblockunlessMETH_GETorMETH_POSTorMETH_OPTIONSToselectadifferentbackendforrequeststostaticcontentsonthe"www"siteandtoeveryrequestonthe"img","video","download"and"ftp"hosts: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.#nowusebackend"static"forallstatic-onlyhosts,andforstaticurls#ofhost"www".Usebackend"www"fortherest.use_backendstaticifhost_staticorhost_wwwurl_staticuse_backendwwwifhost_wwwContentSwitch(UIE/iRule/ACL)frontendpublicreqisetbe^Host:\imgstatic#TheURIwilluseaspecifickeywordsoonreqisetbe^[^\]*\/(img|css)/staticreqisetbe^[^\]*\/admin/statsstatsdefault_backenddynamic#Thestaticbackendbackendfor'Host:img',/imgand/css.backendstatic…backenddynamic…backendstats…if(http_uriends_with“.gif”){usepoolimage_servers}elseif(http_uristarts_with“/foo”){usepoolfoo_servers}elseif(http_cookie(“XYZ-Type”)==“direct”){usepoolcookie_servers}elseif(findstr(http_uri,“?type=”,6,“&”)==“cgi”){usepoolcgi_servers}else{usepoolweb_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_wwwWearehereBasicallyLBrelatedPersistenceSNAT/RNATServerProtectionACL/CSGSLBGSLB如何实现CDN和站点容灾?!IllustratedPerformanceKeep-AliveCompressionIn-memoryCacheServerOffloadTCPBufferingLogging

listenproxy-outmodehttpoptionhttplogoptionlogasaplogglobalservercache1:3128#logthenameofthevirtualservercapturerequestheaderHostlen20#logtheamountofdatauploadedduringaPOSTcapturerequestheaderContent-Lengthlen10#logthebeginningofthereferrercapturerequestheaderRefererlen20#servername(usefulforoutgoingproxiesonly)captureresponseheaderServerlen20#loggingth

温馨提示

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

评论

0/150

提交评论