haproxy cannot bind UNIX socket [/var/lib/haproxy/stats] 已解决

现象

CentOS7.2安装HAProxy1.8.12后启动报错,

[root@fffmo.com run]# journalctl -xe
Jan 22 16:37:10 fffmo.com systemd[1]: Unit haproxy.service entered failed state.
Jan 22 16:37:10 fffmo.com systemd[1]: haproxy.service failed.
Jan 22 16:37:10 fffmo.com systemd[1]: haproxy.service holdoff time over, scheduling restart.
Jan 22 16:37:10 fffmo.com systemd[1]: Cannot add dependency job for unit syslog.service, ignoring: Unit not found.
Jan 22 16:37:10 fffmo.com systemd[1]: Starting HAProxy Load Balancer...
-- Subject: Unit haproxy.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit haproxy.service has begun starting up.
Jan 22 16:37:10 fffmo.com haproxy[14609]: [ALERT] 021/163710 (14609) : Starting frontend GLOBAL: cannot bind UNIX socket
Jan 22 16:37:10 fffmo.com systemd[1]: haproxy.service: control process exited, code=exited status=1
Jan 22 16:37:10 fffmo.com systemd[1]: Failed to start HAProxy Load Balancer.
-- Subject: Unit haproxy.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit haproxy.service has failed.
-- 
-- The result is failed.
Jan 22 16:37:10 fffmo.com systemd[1]: Unit haproxy.service entered failed state.
Jan 22 16:37:10 fffmo.com systemd[1]: haproxy.service failed.
Jan 22 16:37:10 fffmo.com systemd[1]: haproxy.service holdoff time over, scheduling restart.

产生原因

haproxy启动无/var/lib/haproxy/stats文件,导致启动报错。

解决方案

创建/var/lib/haproxy/stats文件

[root@fffmo.com ~]# mkdir -p /var/lib/haproxy

[root@fffmo.com ~]

# touch /var/lib/haproxy/stats 再次启动,成功

[root@fffmo.com ~]

# systemctl start haproxy

[root@fffmo.com ~]

[root@fffmo.com ~]# ps -ef | grep -i haproxy
root     14637     1  0 16:38 ?        00:00:00 /usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
haproxy  14639 14637  0 16:38 ?        00:00:00 /usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
root     14641  2589  0 16:38 pts/0    00:00:00 grep --color=auto -i haproxy
赞(0) 打赏
特别声明:除特殊标注,本站文章均为原创,遵循CC BY-NC 3.0,转载请注明出处。三伏磨 » haproxy cannot bind UNIX socket [/var/lib/haproxy/stats] 已解决

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏