Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining why Redis is receiving a SIGTERM every minute or two

I'm running redis-server on Ubuntu 16.04. After a recent upgrade to redis 3.2.7 I now see lines like

signal-handler (1486427812) Received SIGTERM scheduling shutdown... every minute or two in the redis log and then redis restarts.

The only other suspicious line in the logs is:

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

Any advice on how to diagnose why this is happening would be greatly appreciated. Thanks!

like image 463
Alex Dunae Avatar asked Feb 07 '17 00:02

Alex Dunae


Video Answer


2 Answers

For anyone else still looking for a solution, Type=forking (which is default for redis installed with apt) is incompatible with supervised=systemd in redis.conf.

It has to be updated to Type=simple in /etc/systemd/system/redis.service.

Forking is only required in daemonized mode, but systemd managed redis overrules the daemonized setting.

Change from Restart=always to Restart=on-failure

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

like image 200
Sumit Khurana Avatar answered Sep 17 '22 06:09

Sumit Khurana


Just for the record: As in J G Miller's comment, you have to watch that "Type=simple" and "daemonize yes" settings are incompatible. I struggeld a few days while I found this comment. My redis just simply gave the start-limit-hit error because when the service started it immediately got the SIGTERM signal and stopped.

So either change in the service file the "Type=forking" or the "daemonize no" lines to solve this, depending on your needs.

like image 24
Béla Ormos Avatar answered Sep 20 '22 06:09

Béla Ormos