How to keep redis server running

The easiest way to launch Redis as a daemon is to edit the configuration file and change the following line:

# 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

Be sure to provide the configuration file on the redis-server command line when you launch it.

An example of configuration file is provided in the Redis distribution.


And, if you'd like a quick option, run: redis-server --daemonize yes.


As mentioned by @DidierSpezia in his answer,

Set daemonize yes in Redis conf file. Set daemonize yes in Redis conf file at /path/to/redis.conf Generally it should be there at /etc/.

And :

Then trigger redis-server with the conf file as an argument:

./redis-server /etc/redis.conf

UPDATE You may directly run the redis with demonize flag as well

redis-server --daemonize yes

Tags:

Redis