0

Problem:

I can't seem to figure out how to keep Redis server running when I exit terminal.

Server:

I installed Redis using this quickstart guide: https://redis.io/topics/quickstart

We are running it on an OVH VPS:

Architecture:   x86_64
Operating System:   linux

What have I tried:

redis-server --daemonize yes

Tried the above but would only work when terminal remains open. As soon as I close the terminal the redis server stops.

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes

I changed the configuration but still, whenever I close the terminal the Redis server stops.

nohup redis-server &

Tried with nohup but that aswell didn't work as soon as I closed the terminal.

How to keep redis server running

  • How did you test it stopped when you closed the terminal? When you add the `--daemonize yes` option, does it create the `pid` file you mention? Be sure to delete it before testing. – Mark Setchell Apr 03 '20 at 17:11
  • If we don't find a solution, you can certainly make it work with `tmux` or GNU `screen`, but ideally we'll find a solution without those. – Mark Setchell Apr 03 '20 at 17:13
  • By the way, folks normally start Redis using `systemd` or SysV Init. – Mark Setchell Apr 03 '20 at 17:14
  • @MarkSetchell Well, other features depend on Redis. As soon as I close the terminal those features can't connect to Redis. If I open terminal and type something like {redis-cli} it will return: {Could not connect to Redis at 127.0.0.1:6379: Connection refused}. It does not seem to create the redis.pid. – Imsomeonehello Apr 03 '20 at 17:39
  • Mmm, the lack of a PID file implies something is wrong. Maybe the config file you are editing is not the one Redis is using? Try `redis-cli info | grep -i config_file` to be sure. – Mark Setchell Apr 03 '20 at 17:53
  • https://uploadedcontent.com/2020-04-03-19-57-19-ZTldj.png - Returned this. – Imsomeonehello Apr 03 '20 at 18:00
  • Ok, so it's not using the config file you are editing! Try starting it with `nohup redis-server /path/to/configfile/with/daemonize/yes &` – Mark Setchell Apr 03 '20 at 18:19
  • I think something is going wrong. https://uploadedcontent.com/2020-04-03-20-31-24-U03BH.png – Imsomeonehello Apr 03 '20 at 18:33

0 Answers0