14

so after installing redis onto my ubuntu 20.04 server. Whenever I reboot. A stop job appears for Advanced key-value store. I believe this is part of redis but I don't know why it keeps appearing and taking so long. How do I stop it

2 Answers2

6

I had this issue too and the fix was pretty simple. You need to edit the redis service file defined by the command systemctl show -P FragmentPath redis.service :

$ systemctl show -P FragmentPath redis.service
/lib/systemd/system/redis-server.service

Look for the line that contains TimeoutStopSec and set it to the maximum value in seconds you want. I normally set it to 5 seconds.

After configuring the file, the line should look something like this

TimeoutStopSec=5s

Now that's it, you may want to run the command systemctl daemon-reload just to complement this.

You can then try rebooting or shutting down to confirm the change worked.

Bonus

If you want to set the maximum timeout for the entire system, you do so in the /etc/systemd/system.conf file.

Look for the line DefaultTimeoutStopSec and set it just as you did previously.

SebMa
  • 2,927
  • 5
  • 35
  • 47
0

check your /etc/redis/redis.log file for the reason why it cant restart.

For me, i had the following error:

1963:signal-handler (1670871763) Received SIGTERM scheduling shutdown...
1963:M 12 Dec 2022 14:02:43.145 # User requested shutdown...
1963:M 12 Dec 2022 14:02:43.145 * Saving the final RDB snapshot before 
exiting.
1963:M 12 Dec 2022 14:02:43.145 # Failed opening the temp RDB file temp-
1963.rdb (in server root dir /var/log) for saving: Read-only file system
1963:M 12 Dec 2022 14:02:43.145 # Error trying to save the DB, can't exit.
1963:M 12 Dec 2022 14:02:43.145 # Errors trying to shut down the server. 

Check the logs for more information.

To fix it i just ran the following to fix the problem.

sudo chown redis /var/log/redis/redis.log && sudo chmod u+x /var/log/redis/redis.log
Pilot6
  • 92,041
CGray
  • 101
  • 2