How to keep redis server running

I am using redis for session support in a nodejs application. I installed a redis server and it works when I start the redis server, but when I close the redis terminal it stops and does not work. How to keep redis server forever?

+64
redis
Feb 11 '13 at 16:54
source share
4 answers

The easiest way to start 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 specify the configuration file on the redis-server command line at startup.

An example configuration file is provided in the Redis distribution.

+57
Feb 11
source share

And, if you need a quick option, run: redis-server --daemonize yes .

+132
Dec 23 '15 at 13:20
source share

As @DidierSpezia mentioned in his answer,

Install daemonize yes in the Redis conf file. Install daemonize yes in the Redis conf file in /path/to/redis.conf Normally it should be there /etc/ .

AND:

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

 ./redis-server /etc/redis.conf 
+15
Aug 19 '15 at 10:15
source share

Use nohup to run redis in the background. To run redis in the background, use nohup

  1. go to the redis src directory, in my case it is / opt / redis-stable / src
  2. run the command nohup./redis-server &
  3. Now redis started in the background
  4. Now press Ctrl + C to exit and the logs will be printed in the nohup.out file, you can connect it to the monitor.
  5. use tail -f nohup.out to view redis logs
0
Dec 19 '18 at 13:50
source share



All Articles