One, download and install Redis
cd/usr/local/src/
Wget
TAR-ZXVF redis-2.8.3.tar.gzcd redis-2.8.3makemkdir/usr/local/rediscp redis.conf/usr/local/rediscd./SRCCP REDIS-SERVER/USR/LOCAL/REDISCP REDIS-BENCHMARK/USR/LOCAL/REDISCP redis-cli/usr/local/redisln-sv/usr/local/redis/ Redis-server/usr/local/bin/ln-sv/usr/local/redis/redis-cli/usr/local/bin
At this point, the installation is over, and the following is configuring Redis for the System Management Service.
Second, configure Redis boot
1.1 Edit the Redis configuration file, modify the following parameters
vim/usr/local/redis/redis.conf# By default Redis does not run as a daemon. Use ' yes ' if your need it.# Note that Redis would write a PID file in/var/run/redis.pid when daemonized.daemonize Yes #把no Change to Yes
1.2 Creating the REDISD service
Vim /etc/init.d/redisd# chkconfig: 2345 10 90# description: start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 #实际环境而定EXEC =/usr/ local/redis/src/redis-server #实际环境而定REDIS_CLI =/usr/local/redis/src/redis-cli #实际环境而定 pidfile=/ var/run/redis.pidconf= "/usr/local/redis/redis.conf" #实际环境而定 case "$" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed. " else echo "Starting redis server ... " $EXEC $CONF fi if [ "$?" = "0" ] then echo "Redis is running ..." fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE exists, process is not running." else pid=$ (cat $PIDFILE) echo "Stopping ..." $REDIS _CLI -p $REDISPORT SHUTDOWN while [ -x $PIDFILE ] do echo "Waiting for redis to shutdown ..." sleep 1 done echo "redis stopped" fi ;; restart|force-reload) ${0} stop ${0} start ;; *) &NBsp; echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload} " >&2 exit 1esac
Note Modify the above PID and exec variables according to your installation location to save the exit.
1.3 Set boot up
Chkconfig--add redisdchkconfig--level REDISD on
At this point, you are done. Test it with service Redis [Start|stop|restart] ...
This article is from the "beginner's mind, always" blog, please be sure to keep this source http://gouyc.blog.51cto.com/1594451/1663334
Redis installation Configuration