Redis Cluster Deployment documentation (CENTOS6 System)
(To make the cluster work at least 3 primary nodes, here we will create 6 Redis nodes, of which three are the primary node, three are slave nodes, the corresponding Redis node IP and port correspondence is as follows)
127.0.0.1:7000
127.0.0.1:7001
127.0.0.1:7002
127.0.0.1:7003
127.0.0.1:7004
127.0.0.1:7005
1: Download Redis. Download 3.0.0 version, previous 2. Several versions do not support cluster mode
: https://github.com/antirez/redis/archive/3.0.0-rc2.tar.gz
2: Upload server, unzip, compile
TAR-ZXVF redis-3.0.0-rc2.tar.gz
MV Redis-3.0.0-rc2.tar.gz redis3.0
cd/usr/local/redis3.0
Make
Make install
3: Create the directory required by the cluster
Mkdir-p/usr.local/cluster
Cd/usr.local/cluster
mkdir 7000
mkdir 7001
mkdir 7002
mkdir 7003
mkdir 7004
mkdir 7005
4: Modify configuration file redis.conf
Cp/usr/local/redis3.0/redis.conf/usr.local/cluster
VI redis.conf
# #修改配置文件中的下面选项
Port 7000
Daemonize Yes
cluster-enabled Yes
Cluster-config-file nodes.conf
Cluster-node-timeout 5000
AppendOnly Yes
# #修改完redis These configuration entries in the. conf configuration file, copy the configuration file to the 7000/7001/7002/7003/7004/7005 directory, respectively.
cp/usr/local/cluster/redis.conf/usr/local/cluster/7000
cp/usr/local/cluster/redis.conf/usr/local/cluster/7001
cp/usr/local/cluster/redis.conf/usr/local/cluster/7002
cp/usr/local/cluster/redis.conf/usr/local/cluster/7003
cp/usr/local/cluster/redis.conf/usr/local/cluster/7004
cp/usr/local/cluster/redis.conf/usr/local/cluster/7005
# #注意: To modify the port parameter in the redis.conf file under the 7001/7002/7003/7004/7005 directory after the copy is complete, change the name of the corresponding folder
5: Start each of these 6 Redis instances separately
cd/usr/local/cluster/7000
Redis-server redis.conf
cd/usr/local/cluster/7001
Redis-server redis.conf
cd/usr/local/cluster/7002
Redis-server redis.conf
cd/usr/local/cluster/7003
Redis-server redis.conf
cd/usr/local/cluster/7004
Redis-server redis.conf
cd/usr/local/cluster/7005
Redis-server redis.conf
# #启动之后使用命令查看redis的启动情况ps-ef|grep Redis
If the display indicates a successful start
6: Execute redis Create cluster command to create cluster
Cd/usr/local/redis3.0/src
./redis-trib.rb Create--replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
6.1 error occurs when executing the above command, because it is the Ruby script that is executed and requires the environment of Ruby
Error content:/usr/bin/env:ruby:no such file or directory
So you need to install Ruby's environment, it is recommended to use Yum install Ruby installation
Yum Install Ruby
6.2 Then perform the 6th step of the Create cluster command, also error, hint missing RubyGems component, use Yum to install
Error content:
./redis-trib.rb:24:in ' require ': No such file to load--rubygems (Loaderror)
From./redis-trib.rb:24
Yum Install RubyGems
6.3 Repeat the 6th step of the command, will also error, indicating that the Redis can not be loaded because of the lack of Redis and Ruby interface, using GEM installation
Error content:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in ' Gem_original_require ': No such file to load--Redis ( Loaderror)
From/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in ' require '
From./redis-trib.rb:25
Gem Install Redis
6.4 Execute the 6th step command again, normal execution
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/82/D7/wKiom1diXzvj48EiAAFXo1HJ8x4548.png-wh_500x0-wm_3 -wmp_4-s_2639981835.png "title=" 20150121173116437.png "alt=" Wkiom1dixzvj48eiaafxo1hj8x4548.png-wh_50 "/>
Enter Yes , and then the configuration is complete.
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/82/D7/wKiom1diX2HjAZJWAAFu05OIgxw569.png-wh_500x0-wm_3 -wmp_4-s_1357603714.png "title=" 20150121173132250.png "alt=" Wkiom1dix2hjazjwaafu05oigxw569.png-wh_50 "/>
This is where the Redis cluster is built successfully!
7: Use the REDIS-CLI command to enter the cluster environment
Redis-cli-c-P 7000
This article is from the "djh01" blog, make sure to keep this source http://djh01.blog.51cto.com/10177066/1789951
Redis Cluster Deployment documentation (CENTOS6 System)