How to Fix “systemd supervision requested, but NOTIFY_SOCKET not found” Error in Redis Service


1 views

The error occurs when Redis is configured with supervised systemd but systemd doesn't properly pass the NOTIFY_SOCKET environment variable to the Redis process. This is a common integration issue between Redis and systemd.

When Redis runs under systemd with supervision enabled, it expects to receive a special socket file descriptor through the NOTIFY_SOCKET environment variable. This allows Redis to send status updates to systemd. Without this communication channel, Redis fails to start properly.

Here are three ways to resolve this:

Option 1: Modify the Service File

Update your service file to explicitly set Type=notify:

[Unit]
Description=Redis In-Memory Data Store
After=network.target

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

[Install]
WantedBy=multi-user.target

Option 2: Alternative Configuration (For Older Redis Versions)

If you're running an older Redis version that doesn't fully support systemd notification:

[Service]
Type=forking
PIDFile=/var/run/redis_7000.pid

And add this to your redis.conf:

pidfile /var/run/redis_7000.pid
daemonize yes
supervised no

Option 3: Debugging the Notification System

To verify systemd notification is working:

systemd-notify --ready --status="Redis starting..."
journalctl -u redis7000 -f

After making changes:

sudo systemctl daemon-reload
sudo systemctl restart redis7000
sudo systemctl status redis7000
  • Missing systemd-devel package during Redis compilation
  • Permission issues on the PID file directory
  • Conflicting configurations between redis.conf and service file

For production clusters, consider these additional configurations:

[Service]
LimitNOFILE=65535
OOMScoreAdjust=-200
MemoryHigh=4G
MemoryMax=5G

When trying to start Redis as a systemd service on Ubuntu 16.04, you might encounter the following error in your logs:

systemd supervision requested, but NOTIFY_SOCKET not found

This occurs even when:

  • Redis configuration has supervised systemd enabled
  • The service file appears correctly configured
  • Manual startup works fine with redis-server command

The error indicates Redis is configured for systemd supervision but isn't receiving the necessary environment variable (NOTIFY_SOCKET) from systemd. This typically happens when:

Type=simple

is used in the service file (which is the default if not specified). Redis needs Type=notify to properly communicate with systemd.

Here's the corrected service file that should work:

[Unit]
Description=Redis In-Memory Data Store
After=network.target

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

[Install]
WantedBy=multi-user.target

After modifying the service file:

sudo systemctl daemon-reload
sudo systemctl restart redis7000

Also verify your Redis config contains:

supervised systemd

If the issue persists:

  1. Check Redis logs: journalctl -u redis7000 -f
  2. Verify permissions: sudo chown -R redis:redis /etc/redis/cluster/7000
  3. Test manual startup with systemd environment: sudo -u redis systemd-run --scope --property=Type=notify /usr/local/bin/redis-server /etc/redis/cluster/7000/redis.conf

If you prefer not to use systemd supervision, you can:

1. Set supervised no in redis.conf
2. Change service Type back to simple
3. Use RestartSec to control restart behavior