我想通过haproxy来平衡2 apache / php服务器searchgooglesearch从1.5版本开始,haproxy支持SSL卸载,据我所知,这意味着在haproxy之前不需要任何额外的组件来处理SSL。
基本上,我遵循这篇文章http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/安装haproxy
在我的configuration下面
global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 chroot /usr/share/haproxy uid 99 gid 99 daemon #debug #quiet defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 frontend ft_test mode http bind 0.0.0.0:443 ssl crt /home/prx/haproxy_ssl/haproxy.ssl prefer-server-ciphers # other (self described) options are: [ciphers <suite>] [nosslv3] [notlsv1] default_backend bk_test backend bk_test mode http balance roundrobin server inst1 10.1.2.43:80 check inter 2000 fall 3 server inst2 10.1.2.142:80 check inter 2000 fall 3
问题是,后端服务器同时接收请求,我的意思是,我刷新页面一次,每次有3个请求出现在Web服务器的日志上日志的一个示例
10.1.2.138 - - [24/Jan/2013:12:16:09 -0500] "GET /index.php HTTP/1.1" 200 67170 10.1.2.138 - - [24/Jan/2013:12:16:09 -0500] "GET /index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2524 10.1.2.138 - - [24/Jan/2013:12:16:09 -0500] "GET /index.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2146
有时候2个请求会碰到一个服务器,另一个请求1个,但是1个页面刷新结果到3个请求到达后端我检查了后端服务器configuration,他们都OK
haproxyconfiguration是否错误? 谢谢
是否有可能你看到的这些请求只是多个HTTP请求来加载页面? 我相信roundrobin余额将有每个单独的请求去不同的后端服务器。 如果您希望用户一次只与单个后端服务器进行交互,我认为您需要考虑持久性。 作为另一种可能性,你能看到日志中的后端服务器检查吗?