HAProxy随机空响应 [英] HAProxy random Empty Response

查看:81
本文介绍了HAProxy随机空响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了HAPROXY,以在两台服务器之间保持平衡.不幸的是,HAPROXY返回随机ERR_EMPTY_RESPONSE.我也安装了统计信息,但统计信息不会经常出现,因为有时会显示统计信息.我与一些朋友仔细检查了我的配置,但没有发现问题.

I installed a HAPROXY for balance between two servers. Unfortunately the HAPROXY return random ERR_EMPTY_RESPONSE. I installed the stats also but the stats does not appear frequently because sometimes the stats is shown. I double check with some friends my configuration and I did not found problems.

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随机HTTP 503错误中阅读了类似问题的答案,并且答案不一样.如建议的那样,命令 netstat -tulpn |grep 80 不显示两个HAPROXY正在运行:

I already read the answer of similar question at HAProxy random HTTP 503 errors and the answer is not the same. As suggested there the command netstat -tulpn | grep 80 does not show two HAPROXY running:

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,阅读了很多教程,相信可以找到解决方案.

Well, I dig more into HAProxy and read a lot of tutorials and I believe I found the solution.

我做了两个更改:

  • hdr_end(host)更改为 hdr_dom(host)
  • 添加了 mode http 到:前端http_in 后端srv_audio 后端srv_stats
  • Changed hdr_end(host) to hdr_dom(host)
  • Added mode httpto: frontend http_in, backend srv_audio and backend srv_stats

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

Now, HAPROXY is very stable without bizarre behavior

这篇关于HAProxy随机空响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆