在ubuntu16.04上的etc / systemd / system / redis.service上输入= forking work失败

问题描述 投票:0回答:1

我的/etc/systemd/system/redis.service是

# /etc/systemd/system/redis.service
[Unit]
Description=Redis Server
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
Type=notify
#Type=forking

[Install]
WantedBy=multi-user.target

工作得很好。

但是当我将Type从“notify”更改为web建议“forking”时,我收到了错误,无法重启或停止redis.server

$systemctl restart redis
Job for redis.service failed because a timeout was exceeded. See "systemctl status redis.service" and "journalctl -xe" for details.
redis fork systemd notify
1个回答
2
投票

我们需要确定你的redis.conf文件,但根据this default configuration fileredis-server默认不守护,这意味着Type=forking肯定是不正确的。 Type=notify似乎是最好的选择,因为redis支持systemd的显式就绪通知;但是,这需要supervised选项,默认情况下显然也没有启用。所以你可能想把--supervised systemd添加到ExecStart=指令中。

© www.soinside.com 2019 - 2024. All rights reserved.