sockets - HAProxy 无法启动,无法绑定(bind) UNIX 套接字 [/run/haproxy/admin.sock]

标签 sockets bind startup haproxy

我尝试使用“空”配置文件启动 haproxy(版本 1.5.8 2014/10/31),我得到:

user@server:~$ sudo service haproxy start
[....] Starting haproxy: haproxy[ALERT] 126/120540 (7363) : Starting frontend GLOBAL: cannot bind UNIX socket [/run/haproxy/admin.sock]

尽管已启用:

user@server:~$ cat /etc/default/haproxy 
# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1

配置文件:

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).
    ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
    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

有人知道为什么它无法启动吗?

最佳答案

Haproxy 需要写入 /run/haproxy/admin.sock 但它不会为您创建目录。首先创建目录 /run/haproxy/ 或将 stats socket 设置为不同的路径。

关于sockets - HAProxy 无法启动,无法绑定(bind) UNIX 套接字 [/run/haproxy/admin.sock],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30101075/

相关文章:

黑莓应用程序启动速度非常慢,我该如何解决这个问题?

c - 用 C (Linux) 将原始数据包注入(inject)网络

c++ - 将 boost::threadpool 与 boost::bind 一起使用会使我的程序陷入无限循环

javascript - jquery 与 socket.io 错误

javascript - 动态更改 HTML DOM 事件

dns - 使用 rndc 进行主/从复制

android - 电池拔出后的应用状态

android - 启动动画

C: select() - 信号中断

linux - JBoss 7 HTTPS 连接在手动运行时可以工作,但作为 Linux 服务在 8080 上运行