redis,v3.2, Official link: http://www.redis.io/download, reference: http://blog.csdn.net/mlks_2008/article/details/19001595
1. Installing Redis
wget http://download.redis.io/releases/redis-3.2.1. Tar.gztar xzf redis-3.2.1. TAR.GZCD Redis- 3.2.1 Make
2. Set up Redis for boot
- Redis commands will be copied to/usr/local/bin.
CP redis.conf/etc/
- To create a Redis script execution file: Vi/etc/init.d/redis
The script reads as follows:
# chkconfig:2345 10 90
# Description:start and Stop Redis path=/usr/local/bin:/sbin:/usr/bin:/bin Redisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-CLI Pidfile=/var/run/redis.pidconf="/etc/redis.conf" Case" $" inchstart)if[- F $PIDFILE] then echo"$PIDFILE exists, process is already running or crashed" ElseEcho"starting Redis Server ..." $EXEC $CONFfiif["$?"="0"] then echo"Redis is running ..."fi;; Stop)if[ !- F $PIDFILE] then echo"$PIDFILE does not exist, process was not running" ElsePID=$ (cat$PIDFILE) echo"stopping ..." $REDIS _cli-P$REDISPORTSHUTDOWN while[-X${pidfile} ] DoEcho"waiting for Redis to shutdown ..."Sleep1Done Echo"Redis stopped"fi;; Restart|force-Reload)${0}Stop${0}start;; *) echo"Usage:/etc/init.d/redis {start|stop|restart|force-reload}">&2Exit1Esac##############################
- Then set the properties of this file
chmod +x/etc/init.d/redis
- Change Daemonize No to daemonize Yes
Vim/etc/redis.conf
- Setting up the Boot service
Chkconfig Redis on
3. Common commands
Start the service:
/etc/init.d/redis start
Stop service:
/etc/init.d/redis stop
Test command:
redis-CLI 127.0.0.1:6379> set foo 123 127.0.0.1:6379> get foo
Installing the Redis CentOS7 installation Nodejs+express+mongodb+redis