2

I have installed redis on Ubuntu 16.04 according to the digialtocean guide. It uses systemd and should start on boot.

I can start redis from cli

sudo systemctl start redis

and it works with no error or issue. However when I reboot, redis fails to start. I tried several things I found via googling, nothing worked so far:

  • setting Type=forking or Type=notify (or leaving it away entirely like in the guide)
  • Adding LimitNOFILE=65536 to get rid of an error (which it does but still fails to load)

There is no clear error in journalctl:

Lubuntu-16-04 systemd[1]: Starting Redis In-Memory Data Store...
Lubuntu-16-04 redis-server[799]: 799:C 12 Jul 10:34:12.532 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
Lubuntu-16-04 redis-server[799]: 799:C 12 Jul 10:34:12.532 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=799, just started
Lubuntu-16-04 redis-server[799]: 799:C 12 Jul 10:34:12.532 # Configuration loaded
Lubuntu-16-04 redis-server[799]: 799:C 12 Jul 10:34:12.532 * supervised by systemd, will signal readiness
Lubuntu-16-04 systemd[1]: Started Redis In-Memory Data Store.
Lubuntu-16-04 systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Lubuntu-16-04 systemd[1]: redis.service: Control process exited, code=exited status=1
Lubuntu-16-04 systemd[1]: redis.service: Unit entered failed state.
Lubuntu-16-04 systemd[1]: redis.service: Failed with result 'exit-code'.
Lubuntu-16-04 systemd[1]: redis.service: Service hold-off time over, scheduling restart.
Lubuntu-16-04 systemd[1]: Stopped Redis In-Memory Data Store.

This block is repeated 5 times in the log and then at the end of the log this message appears:

Lubuntu-16-04 systemd[1]: redis.service: Start request repeated too quickly.
Lubuntu-16-04 systemd[1]: Failed to start Redis In-Memory Data Store.

In the redis log I see this:

Creating Server TCP listening socket 192.168.XX.XXX:6379: bind: Cannot assign requested address

I want to allow remote connection, that is why I also bind to "external" IP. Is this causing redis to fail startup? But it works fine when starting manually. What is causing the issue?

beginner_
  • 191
  • 1
  • 8

1 Answers1

2

The systemd config needs to be changed and IMHO is wrong as shown on digitalocean.

The systemd unit configurations After target needs to be changed:

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

In the guide it is After=network.target which according to this guide has very little meaning, eg. the network is probably not yet fully ready and hence binding to external IP fails.

beginner_
  • 191
  • 1
  • 8