Web Program Ape Blog: Http://blog.csdn.net/thinkercode
Redis Installation
I. Installation of Redis
[root@localhost ~]# wget http://download.redis.io/releases/redis-3.0.2.tar.gz[root@localhost ~]# tar xzf redis-3.0.2.tar.gz [root@localhost ~]# cd redis-3.0.2[root@localhost redis-3.0.2]# make PREFIX=/usr/local/redis install
When make executes, several executables are generated in the/usr/local/redis/bin/directory, and their respective roles are:
Redis-server:redis Server Daemon Startup program
Redis-cli:redis command-line operation tool. Of course, you can also use Telnet to operate on its plain text protocol.
Redis-benchmark:redis Performance testing tools to test the read and write performance of Redis in your system and in your configuration
Redis-check-aof: Update log check, add –fix parameter to repair log file
Redis-check-dump: Check the Export tool
Second, configure Redis
[root@localhost redis-3.0.2]# cp redis.conf /usr/local/redis/[root@localhost redis-3.0.2]# vi /usr/local/redis/redis.conf# 修改daemonize no为daemonize yes,目的使进程在后台运行
Third, start Redis
[Root@localhostredis-3.0.2]#/usr/local/redis/bin/redis-server/usr/local/redis/redis.conf &[1]8055[Root@localhostredis-3.0.2]# PS Aux|grep redisRoot8056 0.1 0.7 137440 7452? SSL 08:Panax Notoginseng 0:xx/usr/Local/redis/bin/redis-server*:6379Root8062 0.0 0.0 103248 876pts/0s+ 08:Panax Notoginseng 0:xx grepRedis[root@localhostredis-3.0.2]#/USR/LOCAL/REDIS/BIN/REDIS-CLI127.0.0.1:6379> Set Test Valueok127.0.0.1:6379> Get Test"Value"127.0.0.1:6379>Exit
Four, set the boot start
[Email protected] redis-3.0.2]# Vi/etc/init.d/redis-server#--------------------The following is the startup script content--------------------------#!/bin/bash#chkconfig: 2345# Simple Redis init.d script conceived to work on Linux systems# as it does use of the/proc filesystem.redisport=6379exec=/usr/local/redis/bin/redis-servercliexec=/usr/local/redis/bin/redis-cliconf="/usr/local/redis/redis.conf" Case "$" inchStartEcho "Starting Redis server ..." $EXEC $CONF>/dev/null&;; StopEcho "Stopping ..." $CLIEXECShutdownEcho "Redis stopped";; RestartEcho "Stopping ..." $CLIEXECShutdownEcho "Redis stopped" Echo "Starting Redis server ..." $EXEC $CONF>/dev/null &; *)Echo "Please use start or stop or restart as first argument";;Esac#--------------------End of script--------------------------[Email protected] redis-3.0.2]# chmod +x/etc/init.d/redis-server[Email protected] redis-3.0.2]# service Redis-server StopStopping ... Redis Stopped[[email protected] redis-3.0.2]# PS Aux|grep redisRoot8080 0.0 0.0 103248 872pts/0S+ ,: + 0:xxgrep redis[[email protected] redis-3.0.2]# service Redis-server startStarting Redis Server ... [Email protected] redis-3.0.2]# PS Aux|grep redisRoot8088 0.0 0.7 40608 7444? Ssl ,: + 0:xx/usr/local/redis/bin/redis-server *:6379Root8092 0.0 0.0 103248 876pts/0S+ ,: + 0:xxgrep redis[[email protected] redis-3.0.2]# service Redis-server RestartStopping ... Redis stoppedstarting Redis Server ... [Email protected] redis-3.0.2]# PS Aux|grep redisRoot8101 0.0 0.7 40608 7456? Ssl ,: + 0:xx/usr/local/redis/bin/redis-server *:6379Root8105 0.0 0.0 103248 876pts/0S+ ,: + 0:xxgrep redis[[email protected] redis-3.0.2]# chkconfig--add redis-server[Email protected] redis-3.0.2]# chkconfig Redis-server on[Email protected] redis-3.0.2]# chkconfig--listAuditd0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Blk-availability0: Close1: Enable2: Enable3: Enable4: Enable5: Enable6: Close Crond0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Ip6tables0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Iptables0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Turn off iSCSI0: Close1: Close2: Close3: Enable4: Enable5: Enable6: Close Iscsid0: Close1: Close2: Close3: Enable4: Enable5: Enable6: Close Lvm2-monitor0: Close1: Enable2: Enable3: Enable4: Enable5: Enable6: Close Mdmonitor0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close MULTIPATHD0: Close1: Close2: Close3: Close4: Close5: Close6: Close Netconsole0: Close1: Close2: Close3: Close4: Close5: Close6: Close Netfs0: Close1: Close2: Close3: Enable4: Enable5: Enable6: Close Network0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Postfix0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Rdisc0: Close1: Close2: Close3: Close4: Close5: Close6: Close Redis-server0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Restorecond0: Close1: Close2: Close3: Close4: Close5: Close6: Close Rsyslog0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close SASLAUTHD0: Close1: Close2: Close3: Close4: Close5: Close6: Turn off sshd0: Close1: Close2: Enable3: Enable4: Enable5: Enable6: Close Udev-post0: Close1: Enable2: Enable3: Enable4: Enable5: Enable6: Close
Redis Service Deployment