Wednesday, August 29, 2012

Redis Installation

Redis Installation
Redis is an integral part of SMG Blackbird architecture. Here's how to install Redis:
Redis is a high performance key-value store that can be easily integrated with a variety of applications. Redis can handle many inserts (sets) by keeping newly added values in memory and writing them to disk over time. To install Redis on CentOS 5.6, run the following commands as root.
Installation
# sudo su
# yum install make gcc wget telnet
# wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz
# tar -xf redis-2.4.4.tar.gz
# cd redis-2.4.4
# make && make install


We're going to change the default redis.conf file to daemonize it, change the location of the database, change the log notices to a production acceptable level, and change the logfile location.
# mkdir /etc/redis /var/lib/redis
# sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel debug$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" redis.conf > /etc/redis/redis.conf
To make management easy, we're going to use an init script that I found here on [1]. The install location on this script doesn't match where the /usr/local/bin/redis-server location we're using, so I'm using sed to update it.
# wget https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
sed -i "s/usr\/local\/sbin\/redis/usr\/local\/bin\/redis/" redis-server
# chmod u+x redis-server
# mv redis-server /etc/init.d
# /sbin/chkconfig --add redis-server
# /sbin/chkconfig --level 345 redis-server on
# /sbin/service redis-server start


No comments:

Post a Comment