确定Redis每隔一两分钟收到SIGTERM的原因

时间:2017-02-07 00:44:43

标签: ubuntu redis ubuntu-16.04

我在Ubuntu 16.04上运行redis-server。在最近升级到redis 3.2.7之后,我现在看到像

这样的行

signal-handler (1486427812) Received SIGTERM scheduling shutdown... 在redis日志中每隔一两分钟再重新启动。

日志中唯一的其他可疑行是:

# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

如何诊断出现这种情况的原因将不胜感激。谢谢!

3 个答案:

答案 0 :(得分:2)

对于仍在寻找解决方案的其他任何人,Type=forking(这是与 apt 一起安装的 redis 的默认设置)与 redis.conf 中的 supervised=systemd 不兼容。

它必须在 /etc/systemd/system/redis.service 中更新为 Type=simple。

只有在守护模式下才需要分叉,但 systemd 管理的 redis 会否决守护设置。

从 Restart=always 更改为 Restart=on-failure

参考-redis.conf, https://www.freedesktop.org/software/systemd/man/systemd.service.html

答案 1 :(得分:1)

这是通过apt-get清除和重新安装来解决的。旧的init文件与redis.conf文件不能很好地协同工作。

答案 2 :(得分:1)

仅作记录: 就像J G Miller的评论一样,您必须注意“ Type = simple”和“ daemonize yes”设置不兼容。找到这篇评论后,我努力了几天。我的redis只是给出了start-limit-hit错误,因为当服务启动时,它立即收到SIGTERM信号并停止。

因此,可以根据需要在服务文件中更改“ Type = forking”或“ daemonize no”行来解决此问题。

相关问题