One: Install Redis
1, download the source code, decompression after the compilation of source code
# wget http://download.redis.io/releases/redis-2.8.3.tar.gz
# tar xzf redis-2.8.3.tar.gz
# CD redis-2.8.3
# Make
2, into the installation directory of the SRC folder, there are four executable files Redis-server, Redis-benchmark, Redis-cli and redis.conf, copied to the same directory
# Mkdir/usr/redis # cp
redis-server /usr/redis
# cp Redis-benchmark/usr/redis
# CP REDIS-CLI / Usr/redis
# cp redis.conf /usr/redis
# Cd/usr/redis
3, Start Redis service.
# Cd/usr/redis
#/redis-server redis.conf
Startup exception:Case one: [17496] The Oct 11:48:09.153 # Server started, Redis version 2.8.17
[17496] 11:48:09.153 # WARNING Overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ' vm.overcommit_memory = 1 ' to/etc/sysctl.conf and then reboot or run the command ' Sysctl vm.overcom Mit_memory=1 ' for this to take effect.
[17496] 11:48:09.153 * The server is now ready to accept connections on port 6379
Workaround: Edit/etc/sysctl.conf, add a vm.overcommit_memory = 1, reboot effective.
4, client testing.
Redis 127.0.0.1:6379> #显示此行意味着安装成功.
Two: Set up Redis boot environment: linux-centos6.6
1. Write Startup Scripts
Note: The default redis.conf file parameter is started by the foreground, and modifying Daemonize No to daemonize Yes is started in the background.
The encoding format of the script on the window encoded on Linux may not be recognized, you can use UltraEdit conversion format "file--> conversion-->dos to UNIX"
#!/bin/sh #chkconfig: 345 #description: Startup and Shutdown script for Redis Progdir=/usr/redis #安装路径 progname=re
Dis-server daemon= $PROGDIR/$PROGNAME config=/usr/redis/redis.conf pidfile=/var/run/redis.pid desc= "Redis DAEMON" Scriptname=/etc/rc.d/init.d/redis Start () {if test-x $DAEMON then echo-e starting $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
Put the Redis script file in the/etc/rc.d/init.d/directory 2, add service and boot
# chmod +x/etc/rc.d/init.d/redis
# chkconfig--add redis
# chkconfig--level 345 redis on
# chkconfig--list Redis
3, restart the test.