- PHPGraphLib Graphing Library
- SkinnyTip Tooltip Library
- Web Development Blog
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.
sudo su yum install make gcc wget telnet wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz tar -xf redis-2.2.12.tar.gz cd redis-2.2.12 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 github. 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
To test your installation, run the following commands:
telnet 127.0.0.1 6379 set attitude:today "happy" get attitude:today
There are additional settings that you may want to take a look at in your redis.conf file located at /etc/redis/redis.conf.