Centos installs redis3 to serve the system
# No wget. Run the yuminstallwget command to install the tool.wgethttp://download.redis.io/releases/redis-3.0.1.tar.gztarxzfredis-3.0.1.tar.gzcdredis-3.0.1make# If you do not have the make command, download yuminstallgccmakemaketestmakeinstall
After redis is installed, copy the binfile to usr/local/bin (This step is very important, and no errors will be reported in this step)
?cpredis-server/usr/local/bin/cpredis-cli/usr/local/binModify redis. conf and enable the backend running options:
?daemonizeyesWrite and start shell: vim/Etc/init. d/redis (copy online)
?#chkconfig:23451090#description:StartandStopredisPATH=/usr/local/bin:/sbin:/usr/bin:/binREDISPORT=6379# EXEC =/usr/local/redis/src/redis-server # REDIS_CLI =/usr/local/redis/src/redis-cli # actual environment environment dependsPIDFILE=/var/run/redis.pidCONF="/usr/local/redis/redis.conf"# Depends on the actual environmentcase"$1"instart)if[-f$PIDFILE]thenecho"$PIDFILEexists,processisalreadyrunningorcrashed."elseecho"StartingRedisserver..."$EXEC$CONFfiif["$?"="0"]thenecho"Redisisrunning..."fi;;stop)if[!-f$PIDFILE]thenecho"$PIDFILEexists,processisnotrunning."elsePID=$(cat$PIDFILE)echo"Stopping..."$REDIS_CLI-p$REDISPORTSHUTDOWNwhile[-x$PIDFILE]doecho"WaitingforRedistoshutdown..."sleep1doneecho"Redisstopped"fi;;restart|force-reload)${0}stop${0}start;;*)echo"Usage:/etc/init.d/redis{start|stop|restart|force-reload}">&2exit1esacGrant permissions to chmod + x/etc/init. d/redis
Set boot start:
?# Try to start or stop redisserviceredisstartserviceredisstop# Enable chkconfigredison