Redis service deployment and redis deployment
Web programmer blog: http://blog.csdn.net/thinkercode
Install Redis
1. Install 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
After make is executed, several executable files will be generated in the/usr/local/redis/bin/directory. Their Respective functions are as follows:
Redis-server: daemon Startup Program of the Redis server
Redis-cli: Redis command line operation tool. Of course, you can also use telnet to operate based on its plain text protocol.
Redis-benchmark: Redis performance testing tool to test the read/write performance of Redis in your system and your configuration
Redis-check-aof: Update log check. The-fix parameter is added to fix the log file.
Redis-check-dump: check the export tool
Ii. Configure Redis
[Root @ localhost redis-3.0.2] # cp redis. conf/usr/local/redis/[root @ localhost redis-3.0.2] # vi/usr/local/redis. conf # modify daemonize no to daemonize yes to enable the process to run in the background
Iii. Start Redis
[root@localhost redis-3.0.2]# /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf &[1] 8055[root@localhost redis-3.0.2]# ps aux|grep redisroot 8056 0.1 0.7 137440 7452 ? Ssl 08:37 0:00 /usr/local/redis/bin/redis-server *:6379 root 8062 0.0 0.0 103248 876 pts/0 S+ 08:37 0:00 grep redis[root@localhost redis-3.0.2]# /usr/local/redis/bin/redis-cli 127.0.0.1:6379> set test valueOK127.0.0.1:6379> get test"value"127.0.0.1:6379> exit
4. Set startup
[Root @ localhost redis-3.0.2] # vi/etc/init. d/redis-server # -------------------- The following is the startup script content --------------------------#! /Bin/bash # chkconfig: 2345 80 90 # Simple Redis init. d script conceived to work on Linux systems # as it does use of the/proc filesystem. REDISPORT = 6379 EXEC =/usr/local/redis/bin/redis-serverCLIEXEC =/usr/local/redis/bin/redis-cliCONF = "/usr/local/redis. conf "case" $1 "in start) echo" Starting Redis server... "$ EXEC $ CONF>/dev/null &; stop) echo" Stopping... "$ CLIEXEC shutdown echo" Redis stoppe D "; restart) echo" Stopping... "$ CLIEXEC shutdown echo" Redis stopped "echo" Starting Redis server... "$ EXEC $ CONF>/dev/null &; *) echo" Please use start or stop or restart as first argument ";; esac # -------------------- script end ------------------------ [root @ localhost redis-3.0.2] # chmod + x/etc/init. d/redis-server [root @ localhost redis-3.0.2] # service redis-server stopStopping... redis stopped [Root @ localhost redis-3.0.2] # ps aux | grep redisroot 8080 0.0 0.0 103248 pts/0 S + grep redis [root @ localhost redis-3.0.2] # service redis-server startstartstarting Redis server... [root @ localhost redis-3.0.2] # ps aux | grep redisroot 8088 0.0 0.7 40608 7444? Ssl/usr/local/redis/bin/redis-server *: 6379 root 8092 0.0 0.0 103248 pts/0 S + grep redis [root @ localhost redis-3.0.2] # service redis-server restartStopping... redis stoppedStarting Redis server... [root @ localhost redis-3.0.2] # ps aux | grep redisroot 8101 0.0 0.7 40608 7456? Ssl/usr/local/redis/bin/redis-server *: 6379 root 8105 0.0 0.0 103248 pts/0 S + grep redis [root @ localhost redis-3.0.2] # chkconfig -- add redis-server [root @ localhost redis-3.0.2] # chkconfig redis-server on [root @ localhost redis-3.0.2] # chkconfig -- listauditd 0: disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable blk-availability 0: Disable 1: Enable 2: Enable 3: Enable 4: Enable 5: enable 6: Disable crond 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable ip6tables 0: Disable 1: Disable 2: Enable 3: enable 4: Enable 5: Enable 6: Disable iptables 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable iscsi 0: Disable 1: disable 2: Disable 3: Enable 4: Enable 5: Enable 6: Disable iscsid 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: Enable 6: close lvm2-monitor 0: Close 1: Enable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable mdmonitor 0: Disable 1: Disable 2: Enable 3: Enable 4: enable 5: Enable 6: Disable multipathd 0: Disable 1: Disable 2: Disable 3: Disable 4: Disable 5: Disable 6: Disable netconsole 0: Disable 1: Disable 2: disable 3: Disable 4: Disable 5: Disable 6: Disable netfs 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: Enable 6: disable network 0: disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable postfix 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: disable rdisc 0: Disable 1: Disable 2: Disable 3: Disable 4: Disable 5: Disable 6: Disable redis-server 0: Disable 1: Disable 2: Enable 3: Enable 4: enable 5: Enable 6: Disable restorecond 0: Disable 1: Disable 2: Disable 3: Disable 4: Disable 5: Disable 6: Disable rsyslog 0: Disable 1: Disable 2: enable 3: Enable 4: Enable 5: Enable 6: Disable saslauthd 0: Disable 1: Disable 2: Disable 3: Disable 4: Disable 5: Disable 6: Disable sshd 0: disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable udev-post 0: Disable 1: Enable 2: Enable 3: Enable 4: Enable 5: enable 6: Disable