HAProxy 后启动报错“cannot bind UNIX socket [/var/run/haproxy/info.sock]”解决

LINUX 专栏收录该内容
132 篇文章 1 订阅

nginx代理服务器出现故障,架构是2台虚拟虚拟机keepalive+haproxy80+nginx8080,

开始以为是keepalive的问题,只要关闭keepalive1就正常了。

后来查看keepalive1的日志:

tail -f /var/log/messages -n 100

看到:

Dec 16 16:18:42 nginx01 haproxy-systemd-wrapper: [ALERT] 349/161842 (7527) : Starting frontend GLOBAL: cannot bind UNIX socket [/var/run/haproxy/info.sock]
Dec 16 16:18:42 nginx01 haproxy-systemd-wrapper: haproxy-systemd-wrapper: exit, haproxy RC=1
Dec 16 16:18:42 nginx01 systemd: haproxy.service: main process exited, code=exited, status=1/FAILURE
Dec 16 16:18:42 nginx01 systemd: Unit haproxy.service entered failed state.
Dec 16 16:18:42 nginx01 systemd: haproxy.service failed.
Dec 16 16:20:50 nginx01 systemd: Started HAProxy Load Balancer.
Dec 16 16:22:58 nginx01 systemd: Starting Cleanup of Temporary Directories...
Dec 16 16:22:58 nginx01 systemd: Started Cleanup of Temporary Directories.

 其实就是报haproxy故障

查看haproxy服务状态,果然haproxy无法启动: 

[root@nginx01 conf.d]# systemctl restart haproxy.service
[root@nginx01 conf.d]# systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-12-16 16:18:42 CST; 2s ago
  Process: 7526 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 7526 (code=exited, status=1/FAILURE)

Dec 16 16:18:42 nginx01 systemd[1]: Started HAProxy Load Balancer.
Dec 16 16:18:42 nginx01 haproxy-systemd-wrapper[7526]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
Dec 16 16:18:42 nginx01 haproxy-systemd-wrapper[7526]: [ALERT] 349/161842 (7527) : Starting frontend GLOBAL: cannot bind UNIX socket [/var/run/haproxy/info.sock]
Dec 16 16:18:42 nginx01 haproxy-systemd-wrapper[7526]: haproxy-systemd-wrapper: exit, haproxy RC=1
Dec 16 16:18:42 nginx01 systemd[1]: haproxy.service: main process exited, code=exited, status=1/FAILURE
Dec 16 16:18:42 nginx01 systemd[1]: Unit haproxy.service entered failed state.
Dec 16 16:18:42 nginx01 systemd[1]: haproxy.service failed.

找到问题所在: 

创建目录和文件 

mkdir  /var/run/haproxy/
touch /var/run/haproxy/info.sock

 重启haproxy服务

[root@nginx01 conf.d]# systemctl restart haproxy.service
[root@nginx01 conf.d]# systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-12-16 16:20:50 CST; 2s ago
 Main PID: 9041 (haproxy-systemd)
   CGroup: /system.slice/haproxy.service
           ├─9041 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
           ├─9042 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
           └─9043 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds

Dec 16 16:20:50 nginx01 systemd[1]: Started HAProxy Load Balancer.
Dec 16 16:20:50 nginx01 haproxy-systemd-wrapper[9041]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds

 

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:游动-白 设计师:我叫白小胖 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值