‘Redis’ is an Open source key-value data store. Key values are more complex types like Hashes, Lists, Sets or Sorted Sets. It is a highly scalable data store which is shared by multiple processes, multiple applications, or multiple Servers.
How to install and configure redis server on Centos/Fedora server
1. How to Install and Configure Redis-Server on Centos/ Fedora Server
‘Redis’ is an Open source key-value data store. Key values are more complex types like
Hashes, Lists, Sets or Sorted Sets. It is a highly scalable data store which is shared by
multiple processes, multiple applications, or multiple Servers.
Steps to install ‘Redis’:
Step-1
Install prerequisites packages for the ‘Redis’ server
#yum install make gccwget
Step-2
Download Redis Packages and unzip
#wgethttp://redis.googlecode.com/files/redis-2.2.12.tar.gz
#tar -xf redis-2.2.12.tar.gz
Step-3
we are ready to install Redis from the source.
#cd redis-2.2.12
#makez
#make install
Step- 4
Now we will modify the default configuration of the Redis and change the location of the
database. We would also change the log notices to a production acceptable level and
the location of the log file.
#mkdir /etc/redis/var/lib/redis
#sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir .//dir /var/lib/redis//" -e "s/
/var/log/redis.log/" redis.conf > /etc/redis/redis.conf
Step-5
Add the ‘redis’ init script.
#vi /etc/init.d/redis-server
Add the below lines
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/redis-server
2. DAEMON_ARGS=/etc/redis/redis.conf
NAME=redis-server
DESC=redis-server
PIDFILE=/var/run/redis.pid
test -x $DAEMON || exit 0
test -x $DAEMONBOOTSTRAP || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
touch $PIDFILE
chownredis:redis $PIDFILE
if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuidredis:redis --e
background -- $DAEMON_ARGS
then
echo "$NAME."
else
echo "failed"
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
then
echo "$NAME."
else
echo "failed"
fi
rm -f $PIDFILE
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Note:Give appropriate permission to the init script
chmodu+x
redis-server
Step-6
To run the ‘redis’ server at startup we need to add it to the chkconfig list.
#/sbin/chkconfig --add redis-server
#/sbin/chkconfig --level 345 redis-server on
3. Step-7
Finally we are ready to start the Redis Server.
# /etc/init.d/redis-server start
Conclusion:
‘Redis’ also supports datatypes such as Transitions, Publish and Subscribe. ‘Redis ’ is
considered more powerful than ‘Memcache’ . It would be smart to bring ‘Redis’ into
practice and put ‘Memcache’ down for a while.