HAProxy启动失败

3

我似乎无法启动我的HAProxy,有什么想法是什么原因导致的吗?

root@haproxy-www:/# service haproxy restart
root@haproxy-www:/# service haproxy status
haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Mon 2017-10-02 17:21:11 AEDT; 4s ago
     Docs: man:haproxy(1)
           file:/usr/share/doc/haproxy/configuration.txt.gz
  Process: 11014 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f ${CONFIG} -p /run/haproxy.pid $EXTRAOPTS (code=exited, status=0/SUCCESS)
  Process: 11011 ExecStartPre=/usr/sbin/haproxy -f ${CONFIG} -c -q (code=exited, status=0/SUCCESS)
 Main PID: 11014 (code=exited, status=0/SUCCESS)

Oct 02 17:21:11 haproxy-www systemd[1]: haproxy.service: Service hold-off time over, scheduling restart.
Oct 02 17:21:11 haproxy-www systemd[1]: Stopped HAProxy Load Balancer.
Oct 02 17:21:11 haproxy-www systemd[1]: haproxy.service: Start request repeated too quickly.
Oct 02 17:21:11 haproxy-www systemd[1]: Failed to start HAProxy Load Balancer.
root@haproxy-www:/# 

这是我的haproxy.cfg文件。
全局配置: 日志 /dev/log local0 日志 /dev/log local1 notice chroot /var/lib/haproxy 状态套接字 /run/haproxy/admin.sock 模式660级别admin 统计超时30秒 用户haproxy 组haproxy 守护进程
    # 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+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
    ssl-default-bind-options no-sslv3

defaults
        log     global
        mode    tcp
        option  tcplog
        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 www
        bind ***.***.***.**:80
        default_backend site-backend

backend site-backend
        balance roundrobin
        mode tcp
        server webserver-1 10.240.0.178:80 check
        server webserver-2 10.240.0.42:80 check

感谢您 =)
2个回答

2

我曾经遇到过类似的问题,我通过以下方式解决:

Haproxy需要写入/run/haproxy/admin.sock,但它不会为您创建目录。首先创建目录/run/haproxy/或将状态套接字设置为其他路径。

来源.


5
我遇到了相似的错误,而且 "admin.sock" 文件已经在该目录中。 - Ashwant Manikoth

0

我曾经遇到过同样的问题。结果发现我在前端绑定上设置的端口已经被占用了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接