HAProxy开始突然拒绝连接

时间:2017-02-27 13:14:59

标签: ubuntu ubuntu-16.04 haproxy

我正在使用HAProxy进行负载平衡。 一切都运行正常,然后突然HAProxy停止运行。

/etc/haproxy/haproxy.cfg

global
        log 127.0.0.1 local2
        chroot /var/lib/haproxy
        user haproxy
        group haproxy
        stats socket /tmp/haproxy

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        timeout http-request    10m
        timeout queue           10m
        timeout connect         10s
        timeout client          5m
        timeout server          5m 
        timeout client-fin      30s
        timeout http-keep-alive 5m
        timeout check           20s
        timeout server-fin      10s 
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http
listen  stats
        bind :10000
        stats enable
        stats refresh 20s
        stats uri /haproxy
        stats auth admin:admin123

frontend http
         bind 10.1.10.20:6351
         default_backend web-backend

backend web-backend
        balance leastconn
        option httpchk HEAD /NotificationService/ping HTTP/1.0\r\nUser-agent:\ LB-Check\r\nHost:\ LB-Check

        server Hostname1 10.1.10.31:6351 check inter 10000 rise 5 fall 5 
        server Hostname2 10.1.10.32:6351 check inter 10000 rise 5 fall 5 
        server Hostname3 10.1.10.35:6351 check inter 10000 rise 5 fall 5 
        server Hostname4 10.1.10.34:6351 check inter 10000 rise 5 fall 5 
        server Hostname5 10.1.10.24:6351 check inter 10000 rise 5 fall 5 
        server Hostname6 10.1.10.30:6351 check inter 10000 rise 5 fall 5 
        server Hostname7 10.1.10.33:6351 check inter 10000 rise 5 fall 5 
        server Hostname8 10.1.10.36:6351 check inter 10000 rise 5 fall 5 
        server Hostname9 10.1.10.25:6351 check inter 10000 rise 5 fall 5 
        server Hostname10 10.1.10.26:6351 check inter 10000 rise 5 fall 5 

日志中没有显示任何内容。 突然记录停止了,最后几行显示了这一点;

Feb 27 17:54:03 localhost haproxy[105895]: Proxy stats started.
Feb 27 17:54:03 localhost haproxy[105895]: Proxy http started.
Feb 27 17:54:03 localhost haproxy[105895]: Proxy web-backend started.
Feb 27 17:54:05 localhost haproxy[105908]: Proxy stats started.
Feb 27 17:54:05 localhost haproxy[105908]: Proxy http started.
Feb 27 17:54:05 localhost haproxy[105908]: Proxy web-backend started.
Feb 27 17:54:06 localhost haproxy[105924]: Proxy stats started.
Feb 27 17:54:06 localhost haproxy[105924]: Proxy http started.
Feb 27 17:54:06 localhost haproxy[105924]: Proxy web-backend started.

当我做hatop -s /tmp/haproxy时 我得到的只是socket error: [Errno 111] Connection refused

我不知道该怎么调试呢。需要帮助。

1 个答案:

答案 0 :(得分:0)

“ hatop -s”是指您在/etc/haproxy/haproxy.cfg中定义的套接字 要运行hatop,请按照以下配置中的说明运行“ hatop -s /var/run/haproxy.sock”。

    global
    log 127.0.0.1   local2
    maxconn 10000
    user haproxy
    group haproxy
    stats socket /var/run/haproxy.sock mode 600 level admin
    stats timeout 2m

您的代码应具有

    global
    log 127.0.0.1   local2
    maxconn 10000
    user haproxy
    group haproxy
    stats socket /tmp/haproxy mode 600 level admin
    stats timeout 2m