First, install Redis (using redis3.0 version)
1, need GCC environment, if not execute the command to install GCC
Yum Install gcc-c++
2, download redis3.0 source package and upload to the server
3. Unzip the source package
tar -zxvf redis-3.0. 0. tar. gz
4. Go to unzip directory to compile
Make
5. Installing Redis
Make Install Prefix=/usr/local/redis
Second, start Redis
1. Copy the redis-conf from the redis-3.0.0 file to the Redis installation directory
2. Then modify the redis.conf file
3. Start Redis in the bin directory
./redis-server redis.conf
Third, the construction of Redis cluster
Note: There are three nodes in the cluster, and each node has one master and one standby. Requires 6 virtual machines. Build a pseudo-distributed cluster here, using 6 Redis instances to simulate.
1. Install Ruby Environment
Yum Install Ruby Yum Install RubyGems
Uploading the Redis Cluster management tool REDIS-TRIB.RB to the server
Installing Ruby's Package
Install redis-3.0. 0. Gem
2. Create a Redis-cluster folder under Local, create 6 Redis instances in this folder, port number from 7001~7006
Copy the Redis installation directory Bin folder
Copy the Redis01 5 copies under the Redis-cluster folder
Modify the redis.conf file in redis01 to Redis06, change the port sequentially to 70001~7006, and open the comment before the cluster-enabled Yes line
3. Copy the Ruby script that created the cluster redis-trib.rb to the Redis-cluster folder
4. Start 6 Redis instances
5. Create a cluster (192.168.242.134 is your own IP, enter Yes confirmation during creation)
./REDIS-TRIB.RB Create--replicas 1
192.168 . 242.134 : 7001
192.168 . 242.134 : 7002
192.168 . 242.134 : 7003
192.168 . 242.134 : 7004
192.168 . 242.134 : 7005
192.168 . 242.134 : 7006
6. Test cluster (-C not missing )
Enter the cluster under either folder
192.168. 25.153 7002 - C
The construction of REDIS cluster environment under Linux