16.04.01 LTS on AWS - Redis no longer working

I installed redis using apt-get install redis-server

The problem for me: the tutorials I've found eg. the other reply to this question assume that redis binaries are located in /usr/local/bin .

On my install they're located in /usr/bin so a fix for that is changing /etc/systemd/system/redis.service to reflect this.

At this point I can at start /usr/bin/redis-server /etc/redis/redis.conf manually and successfully run sudo systemctl start redis.

So what you need to do to get redis working on 16.04 is:

  1. Make sure you installed using apt-get install redis-server, don't download the tar, then make & install.
  2. Create or edit the redis service by running sudo vi /etc/systemd/system/redis.service
  3. Edit it to look like this then save:
[Unit]
Description=Redis Datastore Server
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis/redis_6379
User=redis
Group=redis

Environment=statedir=/var/run/redis
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p ${statedir}
ExecStartPre=/bin/chown -R redis:redis ${statedir}
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/usr/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target
  1. Quit vi back to bash. You should be able to start the service now with sudo systemctl start redis
  2. If point 4 doesn't work you can probably at least start it manually by running sudo /usr/bin/redis-server /etc/redis/redis.conf .

The important part that I had to edit was making sure that

ExecStart=/usr/bin/redis-server /etc/redis/redis.conf

ExecStop=/usr/bin/redis-cli shutdown

lines didn't point to usr/local/bin/foo - need to remove the /local


I had the same problem but the cause was different.

I used redis for testing on a VM with dhcp client.

The config /etc/redis/redis.conf was pointing at the wrong (old) local IP and thus it could not bind the service to the new assigned IP from DHCP.

Here is the log for such problem:

mar 13 12:47:53 dev-vm systemd[1]: Failed to start Advanced key-value store.
mar 13 12:47:53 dev-vm systemd[1]: redis-server.service: Unit entered failed state.
mar 13 12:47:53 dev-vm systemd[1]: redis-server.service: Failed with result 'resources'.
mar 13 12:47:53 dev-vm systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
mar 13 12:47:53 dev-vm systemd[1]: Stopped Advanced key-value store.
mar 13 12:47:53 dev-vm systemd[1]: redis-server.service: Start request repeated too quickly.
mar 13 12:47:53 dev-vm systemd[1]: Failed to start Advanced key-value store.

If you're using Ubuntu, you should have supervised systemd in /etc/redis/redis.conf.