First, installation
1. Official: http://www.redis.cn/download.html
2. Download, unzip, compile
wget http://download.redis.io/releases/redis-2.8.18.tar.gz
tar xzf redis-2.8.18.tar.gz
CD redis-2.8.18 Make
(Note: Errors that may occur when you perform make: 1. GCC is not installed, please first: Yum intsall gcc;2. Installation error error:jemalloc/jemalloc.h:no such file or directory; solution: Make change = = "Make MALLOC = libc)
3. configuration file specified to the custom/use/local/redis
Mkdir/usr/local/redis
cp src/redis-server /usr/local/redis
CP Src/redis-benchmark/usr/local/redis
CP src/redis-cli /usr/local/redis
cp redis.conf /usr/local/redis
4. Test and start
Cd/usr/local/redis
Second, through the custom script, set up boot
1. Start the script
Note: The default redis.conf file parameter is the foreground startup, and the Modify Daemonize No to daemonize Yes is the background boot.
Vi/etc/init.d/redis
Copy the script to/etc/init.d/redis
#!/bin/sh #chkconfig: 2345 #description: Startup and Shutdown script for Redis Progdir=/usr/local/redis #安装路径 Progn Ame=redis-server daemon= $PROGDIR/$PROGNAME config=/usr/local/redis/redis.conf pidfile=/var/run/redis.pid DESC= " Redis Daemon "Scriptname=/etc/init.d/redis start () {if test-x $DAEMON then Echo-e" Startin
G $DESC: $PROGNAME "If $DAEMON $CONFIG then echo-e" OK "
Else Echo-e "Failed" fi else
Echo-e "couldn ' t find Redis Server ($DAEMON)" fi} Stop () {if test-e $PIDFILE then
Echo-e "Stopping $DESC: $PROGNAME" if Kill ' cat $PIDFILE ' then
Echo-e "OK" Else Echo-e "failed"
Fi Else Echo-e "No Redis Server ($DAEMON) running" fi} restart () {ECHO-E "restarting $DESC: $PROGNAME"
Stop start} list () {PS aux | grep $PROGNAME} case $ in start) start
;;
stop) stop;;
restart) restart;;
list) list;;
*) echo "Usage: $SCRIPTNAME {start|stop|restart|list}" >&2 exit 1;; ESAC Exit 0
2. Add services and set up boot
chmod +x/etc/init.d/redis
chkconfig--add redis
chkconfig--level 345 Redis on
3. Testing
Ps-ef |grep Redis//Whether there is already a Redis instance
service Redis Stop
service Redis start
4. Open 6379 port for remote connection
Vi/etc/sysconfig/iptables//Open 6379
Service iptables restart//restart
5. Remote connection: Two ways
A. Installation:
sudo apt-get install Redis-tools
B. Direct Telnet