How to run Redis server as daemon

So I think, that those who will read this article probably know, what is Redis. For those who don't I can say shortly, that this is a software, that is used for storing some maped data ( key => value ) for faster usage. This software could help developers to make their applications by storing some primitive data like for example translations on multi-language webpage or other similar information. In this article I will shortly explain how to make your Redis server run as daemon, since making startup file for this in unix is not an option.

First obviously you need to get it and unpack. It is all explained on official Redis webpage, but for those who want to stay in one place I will explain it here.

Sort of installation

Download, extract and compile Redis with:
$ wget http://redis.googlecode.com/files/redis-2.4.4.tar.gz
$ tar xzf redis-2.4.4.tar.gz
$ cd redis-2.4.4
$ make

So now when everything is ready for starting server comes the part with creating a daemon from this.
Make sure you are in redis directory and do the following:
vim redis.conf

And after that just change 'no' to 'yes' in line with daemonize option
# 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

After you saved file with this change just start server:
$ src/redis-server

This is it. Now you can look it up by typing ps aux and you will see it as a deamon process there.

6 thoughts on “How to run Redis server as daemon

  1. chris

    Hi, I'm running this on Suse Linux and after changing redis.conf as described above it wont run as a daemon, but I'm stll getting the standard output and redis will stop once i stop my terminal session.
    Is there anything I'm missing here? Any help would be much appreciated.

    Chris

    1. Eugene Post author

      @Chris, what ps aux command is showing you about redis if you connect from another terminal? Maybe server needs to be restarted, but I doubt that. I've done everything as it is written here and didn't have any problems, so can't say for sure, that have you encountered.

  2. chris

    Hi Eugene, thanks a lot for your response, it actually does work after disconnecting the session.

  3. Terry

    If you use 'nohup src/redis-server &' the command will start, create a pid file and run as a background task. It will still run, but you don't have to start a new terminal session to get your command prompt back.

Comments are closed.