gpt4 book ai didi

HAProxy 随机空响应

转载 作者:行者123 更新时间:2023-12-04 14:26:11 28 4
gpt4 key购买 nike

我安装了一个 HAPROXY 来平衡两台服务器。不幸的是,HAPROXY 返回随机的 ERR_EMPTY_RESPONSE。我也安装了统计信息,但统计信息并不经常出现,因为有时会显示统计信息。我和一些 friend 仔细检查了我的配置,没有发现问题。

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

我的配置:

  • HA 代理版本 1.6.3(软件包 1.6.3-1ubuntu0.1 amd64)
  • Ubuntu 16.04.2 LTS
  • AWS LightSail 512KB RAM 上的云机
  • 已更新所有软件包的系统。

我已经在 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

最佳答案

好吧,我深入研究了 HAProxy 并阅读了很多教程,我相信我找到了解决方案。

我做了两个改变:

  • hdr_end(host) 更改为 hdr_dom(host)
  • mode http 添加到:frontend http_inbackend srv_audiobackend srv_stats

现在,HAPROXY 非常稳定,没有奇怪的行为

关于HAProxy 随机空响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43016507/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com