Redis Installation
From the official download of the latest Redis installation, official website address: http://redis.io/download
$ wget http://download.redis.io/releases/redis-3.2.3.tar.gz$ tar xzf redis-3.2. 3 . tar.gz$ CD Redis-3.2. 3 $ make$ Make install
Redis Boot
Redisserver/path/to/redis.conf
Redis Off (default port is 6379)
Rediscli-p port-a Password shutdown
View the Reids process
Ps-ef|grep Redis
Set up Redis Boot 1: Configure the Init script, save the Code as Reids, and put it in/etc/init.d/
############################ chkconfig:2345 - Ten# Description:redis isA persistent key-value DatabasePath=/usr/local/Binredisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-Cli#redis Password Password=Yourpasswordpidfile=/var/run/redis.pidconf="/usr/local/reids/conf/redis.conf" Case " $" inchstart)if[ -F $PIDFILE] then echo"$PIDFILE exists, process is already running or crashed" ElseEcho"starting Redis Server ..."$EXEC $CONF fiif["$?"="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 $REDISPORT-a $PASSWORD SHUTDOWN 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##############################
Precautions:
1) The top note means that the Redis service must be started or shut down at run level 2,3,4,5, the priority of the boot is 90, and the priority of the shutdown is 10.
2) If the Execute command appears with $ '/R ': Command not found, this problem is different under Windows line break and Linux, can be converted by nodepad++.
2: Set script permissions
chmod +x/etc/init.d/redis
3: Set Boot boot
sudo chkconfig redis on
4: How to use
Service Redis start #或者/etc/init.d/redis startservice redis stop /etc/init.d/redis stop
Redis Installation and boot setup in Centeros