Configuring Redis on Maverick Meerkat
If you followed my earlier blog post on installing Redis (I’ve updated it a bit), you should already have Redis on the system.
To set Redis up in a production-like environment, we’re going to create an init script, which I’ve modified from Dan’s post. With this, we will also be setting it up to run on boot.
$ cd /etc/init.d $ sudo wget https://raw.github.com/gist/1066656/5e58c1154b3f090b225970c68fb3cea817522e62/redis-server $ sudo chmod +x redis-server $ sudo update-rc.d redis-server defaults
You can continue following Dan’s post, but I’m just going to reproduce the commands here he used to set up a user for running Redis:
$ sudo useradd redis $ sudo mkdir -p /var/lib/redis $ sudo mkdir -p /var/log/redis $ sudo chown redis.redis /var/lib/redis $ sudo chown redis.redis /var/log/redis
Now, you can perform commands on Redis like this:
$ sudo /etc/init.d/redis-server start $ sudo /etc/init.d/redis-server stop $ sudo /etc/init.d/redis-server restart
To really configure Redis for primetime, you will have to edit your config file to suit a production environment.
Note: one issue is that running it this way is that it starts Redis in the foreground. I’m still quite a Linux noob so what I did was restart the server. Since we registered the redis-server executable as a service, it will start Redis on boot in the background.
- emileeyou89-blog liked this
- bonham690-blog liked this
- jaryl posted this