我安装了一个HAPROXY来平衡两个服务器之间的平衡。不幸的是,HAPROXY返回随机ERR_EMPTY_RESPONSE。我也安装了统计数据,但是统计数据并不经常出现,因为有时会显示统计数据。我反复检查了一些朋友,我的配置,我没有发现问题。
defaults
timeout connect 3000ms
timeout server 10000ms
timeout client 10000ms
global
log 127.0.0.1 local0 notice
maxconn 2000
user haproxy
group haproxy
frontend stats
bind *:1936
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth user:password
frontend http_in
bind *:80
acl is_audio hdr_end(host) -i subdomain.myserver.com
acl is_proxystats hdr_end(host) -i stats.myserver.com
use_backend srv_audio if is_audio
use_backend srv_stats if is_proxystats
# acl url_blog path_beg /blog
# use_backend blog_back if url_blog
default_backend srv_audio
backend srv_audio
balance roundrobin
server audio1 10.10.10.1:80 check
server audio2 10.10.10.2:80 check
backend srv_stats
server Local 127.0.0.1:1936我的配置:
我已经在HAProxy random HTTP 503 errors读过类似问题的答案了,答案也不一样。正如建议的那样,命令netstat -tulpn | grep 80没有显示两个HAPROXY正在运行:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - 但是ps ax | grep haproxy返回:
22890 ? Ss 0:00 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
22891 ? S 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
22894 ? Ss 0:31 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds发布于 2017-03-25 16:30:23
嗯,我深入研究了HAProxy,阅读了很多教程,我相信我找到了解决方案。
我做了两个改变:
hdr_end(host)改为hdr_dom(host)mode http添加到:frontend http_in、backend srv_audio和backend srv_stats现在,HAPROXY非常稳定,没有奇怪的行为。
https://stackoverflow.com/questions/43016507
复制相似问题