服务器1(Proxy) – > Server2 / Server3(Apache) – > Server4(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
从长远来看,我认为使用frontend和backend设置会更好,因为它会给你更多的灵活性。
有关基本示例,请参见https://serverfault.com/a/295093/2561 。