由于缺少 pid 文件的权限,haproxy 在 CentOS 上使用 systemd 静默启动失败

由于缺少 pid 文件的权限,haproxy 在 CentOS 上使用 systemd 静默启动失败

我安装了带有 haproxy 的 CentOS 7.4,我已将其更新到 1.8。 Haproxy无法启动,甚至sudo systemctl start haproxy不显示任何输出。

sudo systemctl status haproxy显示这个:

● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Wed 2018-01-31 15:17:37 CET; 2s ago
  Process: 2807 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 2807 (code=exited, status=0/SUCCESS)

Jan 31 15:17:36 foo systemd[1]: Started HAProxy Load Balancer.
Jan 31 15:17:36 foo systemd[1]: Starting HAProxy Load Balancer...
Jan 31 15:17:37 foo haproxy-systemd-wrapper[2807]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -d -Ds
Jan 31 15:17:37 foo haproxy-systemd-wrapper[2807]: haproxy-systemd-wrapper: exit, haproxy RC=0

日志不会产生太多有用的信息:

Jan 31 15:19:43 foo systemd[1]: Started HAProxy Load Balancer.
-- Subject: Unit haproxy.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit haproxy.service has finished starting up.
--
-- The start-up result is done.
Jan 31 15:19:43 awisot3 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.

当我尝试模拟 systemd 的功能并执行 a 时,sudo -u haproxy usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -d -Ds我收到以下错误消息:

[WARNING] 030/152521 (3031) : [/usr/sbin/haproxy.main()] Cannot raise FD limit to 8015, limit is 4096.
[ALERT] 030/152521 (3031) : [/usr/sbin/haproxy.main()] Cannot create pidfile /run/haproxy.pid

如何正确设置对haproxy.pid和 的访问/run?额外问题:为什么journalctl也不披露这些信息?

相关内容