Redis not starting with systemctl
Solution 1:
To run redis under systemd, you need to set supervised systemd
.
See the configuration file:
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstart by putting Redis into SIGSTOP mode
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
supervised no
Needs to be changed to:
supervised systemd
You can also pass this on the command line, which overrides the setting in redis.conf
. Red Hat based systems do this. This also allows for running the same redis instance manually or from systemd without changing the config file.
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
In addition, you also need to tell systemd that redis will be operating in this mode by setting Type=notify
in the [Service]
section.
Solution 2:
As I cannot add a comment due to lack of reputation, please take this as a comment to Michael Hampston's answer.
When modifying the systemd
service file, use the command systemctl edit redis-server
to create an override. In the resulting edit window, type the following:
[Service]
Type=notify
Save and exit then finish the installation apt install -f
.
If you modify the service in /lib/systemd/system
, you'll lose those edits on next update.
See: modify systemd unit file without altering upstream unit file
PS: This question saved me from having to scratch my head for too long as I just encountered the issue.