Download the latest version
Take 3.2.8 For example, attach address: redis-3.2.8.tar.gz unzip, compile, install Redis decompression: tar-zxvf redis-3.2.8.tar.gz into directory: CD redis-3.2.8 compile: Make && make install to create a related directory:
Mkdir-p/opt/redis-3.2.8/bin
mkdir-p/opt/redis-3.2.8/log
mkdir-p/opt/redis-3.2.8/pid
mkdir-p/opt/ redis-3.2.8/db
Copy the compiled executable to your own installation directory: Ln-s/usr/local/bin/redis-*/opt/redis-3.2.8/bin Copy the configuration file to the installation directory: CP redis.conf/opt/redis-3.2.8/
Configure RedisEditing Redis.conf:cd/opt/redis-3.2.8,vi redis.conf Redis only allows native connections by default, so commenting out this line of configuration can be accessed remotely: \# bind 127.0.0.1 redis3.0 version added protection mode, we need to set the password, if you do not want to set the password, the protection mode is turned off: Protected-mode no set up Redis to daemon thread boot: daemonize Yes to configure the Pid,log,db file Save address:
Pidfile/opt/redis-3.2.8/pid/redis.pid
logfile/opt/redis-3.2.8/log/redis.log
dir/opt/redis-3.2.8/db
Other configurations are default, and you need to modify the Redis startup script to write yourself: Vi/etc/init.d/redis
#!/bin/sh # # Simple Redis INIT.D script conceived to work on the Linux systems # as it does use of the/proc filesystem. Path=/opt/redis-3.2.8/bin:/sbin:/usr/bin:/bin redisport=6379 Exec=/opt/redis-3.2.8/bin/redis-server CLIEXEC=/opt/
REDIS-3.2.8/BIN/REDIS-CLI pidfile=/opt/redis-3.2.8/pid/redis.pid conf= "/opt/redis-3.2.8/redis.conf" case "$" in Start) If [-f $PIDFILE] then echo ' $PIDFILE exists, process is already running or Crashe
D "Else echo" starting Redis server ... "$EXEC $CONF fi;;
STOP) if [!-F $PIDFILE] then echo ' $PIDFILE does not exist, process was not running " Else pid=$ (cat $PIDFILE) echo "Stopping ..." $CLIEXEC-P $REDISPORT s Hutdown while [-x/proc/${pid}] does echo "Waiting for Redis to Shutdo
WN ... "Sleep 1 Done echo "Redis stopped" FI;;
*) echo "Please use Start or stop as first argument";;
Esac
Set service permissions: chmod A+x/etc/init.d/redis
related useStart: Service Redis start off: Service Redis stop view: Ps-ef | grep REDIS,NETSTAT-ANPTU | grep 6379
Author: Joepis
Links: https://www.jianshu.com/p/1650f45109b3
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.