错误:在 CentOS 7 (systemctl) 上安装 Varnish 4

Bug: Varnish 4 install on CentOS 7 (systemctl)

已从 yum 安装 Varnish;但通过 systemctl 启动时会立即出错。

Jul 28 14:11:54 localhost.localdomain varnishd[6546]: .init_func = VGC_function_vcl_init,
Jul 28 14:11:54 localhost.localdomain varnishd[6546]: .fini_func = VGC_function_vcl_fini,
Jul 28 14:11:54 localhost.localdomain varnishd[6546]: };
Jul 28 14:11:54 localhost.localdomain varnishd[6557]: Assert error in main(), mgt/mgt_main.c line 686:
Jul 28 14:11:54 localhost.localdomain varnishd[6557]: Condition((daemon(1,0)) == 0) not true.
Jul 28 14:11:54 localhost.localdomain varnishd[6557]: errno = 19 (No such device)
Jul 28 14:11:54 localhost.localdomain systemd[1]: Failed to read PID from file /var/run/varnish.pid: Invalid argument
Jul 28 14:11:54 localhost.localdomain systemd[1]: varnish.service never wrote its PID file. Failing.
Jul 28 14:11:54 localhost.localdomain systemd[1]: Failed to start Varnish a high-perfomance HTTP accelerator.
Jul 28 14:11:54 localhost.localdomain systemd[1]: Unit varnish.service entered failed state.

SELinux 被禁用;软件包是通过 root 安装的。这是全新安装。

看来您需要重启。 ;)

留言:

Failed to read PID from file /var/run/varnish.pid Invalid argument

不重要。只是 systemd 试图过早阅读 pidfile。您可以通过以下方式轮询状态:

systemctl status varnish

如果它的 "Main PID" 条目与 /var/run/varnish.pid 的内容匹配(如果 varnishd 是通过 systemd 启动的,它总是如此),您可以忽略该消息。这在更高版本的 systemd 中已修复。