1.1. Configure Redis
- Setting up the redis installation directory
Mkdir/usr/local/redis
- Change Directory access permissions to tomcat users
Chown-r-V Tomcat/usr/local/redis
- Unzip the Redis source code package
TAR-XVF redis-3.0.1.tar.gz
- Compiling Redis
Enter the Redis source code to extract the directory and execute make
Execute make Test
Page Display Error:
You need TCL 8.5 or newer in order to run the Redis test
Make: * * * [Test] Error 1
Solution:
- wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
- TAR-XZVF tcl8.6.1-src.tar.gz-c/USR/LOCAL/TCL
- cd/usr/local/tcl8.6.1/unix/
- sudo./configure
- sudo make
- sudo make install
- Generating redis Executable Services
After make is successful, there are Some more executables in the SRC directory:redis-server,redis-cli and so on.
During the convenient period, the CP command is copied to the usr directory for operation.
CP redis-server/usr/local/bin/
CP redis-cli/usr/local/bin/
Then create a new directory, store the configuration file
Mkdir/etc/redis
Mkdir/var/redis
Mkdir/var/redis/log
Mkdir/var/redis/run
mkdir/var/redis/6379
Mkdir/var/redis/data
- Redis Environment Configuration
Locate the profile template in the redis solution directory and copy it to the following location.
Adjust Redis service ports to suit your situation
CP redis.conf/etc/redis/6379.conf
Modify 6379.conf with vim command
Daemonize Yes
Pidfile/var/redis/run/redis_6379.pid
Logfile/var/redis/log/redis_6379.log
dir/var/redis/6379
- Redis cluster environment
Clustered Ruby Installation
Yum Install Ruby
Yum Install RubyGems
Gem Install Redis
Cluster environment Configuration variables
Redis cluster environments require a minimum of 6 service applications.
3 Master ports:6380,6381,6382
3 x slaver ports:16380,16381,16382
Start and initialize the cluster
Server 1
/usr/local/bin/redis-server/etc/redis/6380.conf >/var/redis/log/redis-6380.log 2>&1 &
/usr/local/bin/redis-server/etc/redis/6381.conf >/var/redis/log/redis-6381.log 2>&1 &
/usr/local/bin/redis-server/etc/redis/16382.conf >/var/redis/log/redis-16382.log 2>&1 &
Server 2
/usr/local/bin/redis-server/etc/redis/6382.conf >/var/redis/log/redis-6382.log 2>&1 &
/usr/local/bin/redis-server/etc/redis/16380.conf >/var/redis/log/redis-16380.log 2>&1 &
/usr/local/bin/redis-server/etc/redis/16381.conf >/var/redis/log/redis-16381.log 2>&1 &
Start the cluster
/USR/LOCAL/BIN/REDIS-TRIB.RB Create--replicas 1 192.168.1.231:6380 192.168.1.231:6381 192.168.1.233:6382 192.168.1.233:16380 192.168.1.233:16381 192.168.1.231:16382
Related references
http://blog.csdn.net/xu470438000/article/details/42971091
http://blog.csdn.net/myrainblues/article/details/25881535
- Redis Start and stop
Start: redis-server/etc/redis/6379.conf
Stop: REDIS-CLI shutdown
- Redis Common Command Reference
http://blog.csdn.net/yhl27/article/details/9936189
Environment Installation Memo Redis