Apache-2.2

負載平衡設置

  • May 1, 2012

伺服器 1(代理)-> 伺服器 2/伺服器 3(阿帕奇)-> 伺服器 4(mysql)

對於伺服器 1,我會使用類似的東西設置 HARproxy?

global
       log 127.0.0.1   local0
       log 127.0.0.1   local1 notice
       #log loghost    local0 info
       maxconn 4096
       #debug
       #quiet
       user haproxy
       group haproxy

defaults
       log     global
       mode    http
       option  httplog
       option  dontlognull
       retries 3
       redispatch
       maxconn 2000
       contimeout      5000
       clitimeout      50000
       srvtimeout      50000

listen webfarm 192.168.0.99:80
      mode http
      stats enable
      stats auth someuser:somepassword
      balance roundrobin
      cookie JSESSIONID prefix
      option httpclose
      option forwardfor
      option httpchk HEAD /check.txt HTTP/1.0
      server webA 192.168.0.102:80 cookie A check
      server webB 192.168.0.103:80 cookie B check

從長遠來看,我認為使用frontendandbackend設置會更好,因為它會給你更多的靈活性。

有關基本範例,請參閱https://serverfault.com/a/295093/2561

引用自:https://serverfault.com/questions/384945