Haproxy无法重启

时间:2018-04-19 15:01:22

标签: haproxy

我们正面临着启动我们安装的haproxy的问题。 我们使用的是ubuntu 16.04,安装的版本是: HA-Proxy version 1.6.3 2015/12/25 版权所有2000-2015 Willy Tarreau 创建文件夹/ run / haproxy 一切都正确下载。 它卸载了,然后安装了同样的错误,所以我们拼命寻求帮助。

这是文件夹/ etc / default / haproxy

# Defaults file for HAProxy
#
# This is sourced by both, the initscript and the systemd unit file, so do not
# treat it as a shell script fragment.

# Change the config file location if needed
#CONFIG="/etc/haproxy/haproxy.cfg"

ENABLED=1
# Add extra flags here, see haproxy(1) for a few options
#EXTRAOPTS="-de -m 16"

这是/etc/haproxy/haproxy.cfg

    global
            log /dev/log    local0
            log /dev/log    local1 notice
            chroot /var/lib/haproxy
            stats socket /run/haproxy/admin.sock mode 660 level admin
            stats timeout 30s
            user haproxy
            group haproxy
            daemon

            # Default SSL material locations
            ca-base /etc/ssl/certs
            crt-base /etc/ssl/private

            # Default ciphers to use on SSL-enabled listening sockets.
            # For more information, see ciphers(1SSL). This list is from:
            #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
            ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DE$
            ssl-default-bind-options no-sslv3

    defaults
            log     global
            mode    http
            option  httplog
            option  dontlognull
            timeout connect 5000
            timeout client  50000
            timeout server  50000
            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

    frontend myfrontend
            bind *:80
            mode http
            default_backend mybackend

backend mybackend
        mode http
        balance roundrobin
        option httpchkHEAD / HTTP/1.1\r\nHost:\localhost
        server web1 10.10.2.110:80 check weight 10
        server web2 10.10.2.111:80 check weight 20
        server web3 10.10.2.112:80 check weight 30

以下是错误消息:

 ● haproxy.service - HAProxy Load Balancer
       Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
       Active: inactive (dead) (Result: exit-code) since Thu 2018-04-19 14:35:21 UTC; 5s ago
         Docs: man:haproxy(1)
               file:/usr/share/doc/haproxy/configuration.txt.gz
      Process: 29395 ExecStartPre=/usr/sbin/haproxy -f ${CONFIG} -c -q (code=exited, status=1/FAILURE)
     Main PID: 28467 (code=exited, status=0/SUCCESS)

    Apr 19 14:35:20 dats42-lb systemd[1]: Failed to start HAProxy Load Balancer.
    Apr 19 14:35:20 dats42-lb systemd[1]: haproxy.service: Unit entered failed state.
    Apr 19 14:35:20 dats42-lb systemd[1]: haproxy.service: Failed with result 'exit-code'.
    Apr 19 14:35:21 dats42-lb systemd[1]: haproxy.service: Service hold-off time over, scheduling restart.
    Apr 19 14:35:21 dats42-lb systemd[1]: Stopped HAProxy Load Balancer.
    Apr 19 14:35:21 dats42-lb systemd[1]: haproxy.service: Start request repeated too quickly.
    Apr 19 14:35:21 dats42-lb systemd[1]: Failed to start HAProxy Load Balancer.

任何可以提供帮助的人? :)

1 个答案:

答案 0 :(得分:1)

在全局部分下的/etc/haproxy/haproxy.cfg文件中,有这个条目 - stats socket /run/haproxy/admin.sock mode 660 level admin

检查是否创建了admin.sock文件。还要检查是否存在要创建该文件的目录路径。