redis3.0 cluster installation steps

Source: Internet
Author: User
Tags download redis join mkdir redis require stop script redis cluster install redis

The machine that installs the Redis cluster is as follows:
10.0.0.1
10.0.0.2
10.0.0.3

1, download redis-3.0.0-rc1.tar.gz (currently the latest version) uploaded to the above three machines/data directory;

2, respectively decompression redis-3.0.0-rc1.tar.gz, command: Tar xzvf redis-3.0.0-rc1.tar.gz

3, respectively: CD REDIS-3.0.0-RC1

4,make

5,make Install

6, create a folder under/data: mkdir DCP
Create a folder under DCP: MkDir rediscluster
Create under Rediscluster:
Conf----------Store Redis configuration file
Data----------Store Redis files
Log file-----------
PID-----------Store PID file
Script--------store start stop scripts

7, upload the redis.conf_32001 file to the Conf directory, and then:
-rw-r--r--1 root root 1236 Oct 15:14 redis.conf_32001
[root@hz_bjcm133 conf]# CP redis.conf_32001 redis.conf_32002
[root@hz_bjcm133 conf]# CP redis.conf_32001 redis.conf_32003
[root@hz_bjcm133 conf]# CP redis.conf_32001 redis.conf_32004
[root@hz_bjcm133 conf]# CP redis.conf_32001 redis.conf_32005

8,sed-i ' s/192.168.7.198/10.0.0.1/g ' redis.conf_*

9,sed-i ' s/\/data\/dmap\/rediscluster/\/data\/dcp\/rediscluster/g ' redis.conf_*

10,sed-i ' s/32001/32005/g ' redis.conf_32005
Sed-i ' s/32001/32004/g ' redis.conf_32004
Sed-i ' s/32001/32003/g ' redis.conf_32003
Sed-i ' s/32001/32002/g ' redis.conf_32002

11, Start Redis
[Root@hz_bjcm133 conf]#/data/redis-3.0.0-rc1/src/redis-server/data/dcp/rediscluster/conf/redis.conf_32001
[Root@hz_bjcm133 conf]#/data/redis-3.0.0-rc1/src/redis-server/data/dcp/rediscluster/conf/redis.conf_32002
[Root@hz_bjcm133 conf]#/data/redis-3.0.0-rc1/src/redis-server/data/dcp/rediscluster/conf/redis.conf_32003
[Root@hz_bjcm133 conf]#/data/redis-3.0.0-rc1/src/redis-server/data/dcp/rediscluster/conf/redis.conf_32004
[Root@hz_bjcm133 conf]#/data/redis-3.0.0-rc1/src/redis-server/data/dcp/rediscluster/conf/redis.conf_32005

12, viewing the process: PS Aux|grep Redis
Root 22225 0.0 0.0 137408 7456? SSL 14:27 0:00/data/redis-3.0.0-rc1/src/redis-server 10.0.0.1:32001 [cluster]
Root 22230 0.0 0.0 137408 7456? SSL 14:27 0:00/data/redis-3.0.0-rc1/src/redis-server 10.0.0.1:32002 [cluster]
Root 22235 0.0 0.0 137408 7456? SSL 14:27 0:00/data/redis-3.0.0-rc1/src/redis-server 10.0.0.1:32003 [cluster]
Root 22239 0.0 0.0 137408 7456? SSL 14:27 0:00/data/redis-3.0.0-rc1/src/redis-server 10.0.0.1:32004 [cluster]
Root 22265 0.0 0.0 137408 7456? SSL 14:27 0:00/data/redis-3.0.0-rc1/src/redis-server 10.0.0.1:32005 [cluster]

13, perform the same operation on other machines;

14, upload the startup script (start.sh) and Stop script (stop.sh) to the script directory of each machine;

15, download Ruby, I downloaded this version of ruby-2.1.3.tar.gz (Ruby: Programmer's best friend O (∩_∩) o~)
Download Address: https://www.ruby-lang.org/zh_cn/downloads/
The above three machines just install one on the line, here I choose: 10.0.0.3
Upload the ruby-2.1.3.tar.gz to the 137/data directory, extract: Tar xzvf ruby-2.1.3.tar.gz

Ruby Installation Reference: http://www.shangxueba.com/jingyan/97915.html

A, enter ruby-2.1.3 execution:./configure
B,make
C,make Install

OK, now knock: ruby-v
Is there a ruby version number, congratulations, you have successfully installed the ruby!

If the following problems occur:
-bash:ruby:command not found
The workaround is as follows:
Ln-s/usr/local/bin/ruby/bin


16, add all the nodes to the Redis cluster
./redis-trib.rb Create--replicas 1 10.0.0.1:32001 10.0.0.1:32002 10.0.0.1:32003 10.0.0.1:32004 10.0.0.1:32005 10.0.0.2:32001 10.0.0.2:32002 10.0.0.2:32003 10.0.0.2:32004 10.0.0.2:32005 10.0.0.3:32001 10.0.0.3:32003 10.0.0.3:32004 10.0.0.3:32005

./redis-trib.rb Create--replicas 1 118.26.150.166:32001 118.26.150.166:32002 118.26.150.166:32003 118.26.150.166:32004 118.26.150.166:32005 118.26.148.125:32001 118.26.148.125:32002 118.26.148.125:32003 118.26.148.125:32004 118.26.148.125:32005 118.26.150.165:32001 118.26.150.165:32002 118.26.150.165:32003 118.26.150.165:32004 118.26.150.165:32005


17, execute the error
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in ' require ': Cannot load such file--Redis ( Loaderror)
From/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in ' require '
From./redis-trib.rb:25:in ' <main> '
This means that Ruby's Redis interface is not installed and can be installed through the sudo gem install Redis or gem install Redis.

Gem install Redis may download failed due to network reason
Can be downloaded manually:
Download Address: http://rubygems.org/gems/redis/versions/3.0.0
Gem Install-l/data/soft/redis-3.0.0.gem

18, re-execute 16:
>>> Creating cluster
Connecting to Node 10.0.0.1:32001:ok
Connecting to Node 10.0.0.1:32002:ok
Connecting to Node 10.0.0.1:32003:ok
Connecting to Node 10.0.0.1:32004:ok
Connecting to Node 10.0.0.1:32005:ok
Connecting to Node 10.0.0.2:32001:ok
Connecting to Node 10.0.0.2:32002:ok
Connecting to Node 10.0.0.2:32003:ok
Connecting to Node 10.0.0.2:32004:ok
Connecting to Node 10.0.0.2:32005:ok
Connecting to Node 10.0.0.3:32001:ok
Connecting to Node 10.0.0.3:32002:ok
Connecting to Node 10.0.0.3:32003:ok
Connecting to Node 10.0.0.3:32004:ok
Connecting to Node 10.0.0.3:32005:ok
>>> performing hash slots allocation on nodes ...
Using 7 Masters:
10.0.0.1:32001
10.0.0.2:32001
10.0.0.3:32001
10.0.0.1:32002
10.0.0.2:32002
10.0.0.3:32002
10.0.0.1:32003
Adding replica 10.0.0.2:32003 to 10.0.0.1:32001
Adding replica 10.0.0.1:32004 to 10.0.0.2:32001
Adding replica 10.0.0.1:32005 to 10.0.0.3:32001
Adding replica 10.0.0.2:32004 to 10.0.0.1:32002
Adding replica 10.0.0.3:32003 to 10.0.0.2:32002
Adding replica 10.0.0.2:32005 to 10.0.0.3:32002
Adding replica 10.0.0.3:32004 to 10.0.0.1:32003
Adding replica 10.0.0.3:32005 to 10.0.0.1:32001
M:bca6171f8e6a53ca95e487b3e07d3e27e8d588c6 10.0.0.1:32001
slots:0-2340 (2341 Slots) Master
M:ae44168e433c4b58f15f03987100eb95742892da 10.0.0.1:32002
slots:7022-9361 (2340 Slots) Master
m:0939b70560b2ece64642ba021cfaec8be621c17a 10.0.0.1:32003
slots:14043-16383 (2341 Slots) Master
s:fa99bfc99d7e678ceeedd28242b69cd9e61ff05b 10.0.0.1:32004
Replicates E364A7FB06FE9922EA81E7FC41C2891370D5A2AF
S:7ACDAA82E5D52DB1AC1BA209324C30EA62B3B5C3 10.0.0.1:32005
Replicates F307234110ca4246c273f5a4eff3749eee6bd9b6
M:E364A7FB06FE9922EA81E7FC41C2891370D5A2AF 10.0.0.2:32001
slots:2341-4680 (2340 Slots) Master
M:a6182636a6dc7ba2339a425d85b7eabacdb55ed0 10.0.0.2:32002
slots:9362-11702 (2341 Slots) Master
S:2243EEC692146889D850B153E6E54458085C49B9 10.0.0.2:32003
Replicates bca6171f8e6a53ca95e487b3e07d3e27e8d588c6
S:b4ef9345520868fa8a5b00355b3ef85a32821d56 10.0.0.2:32004
Replicates Ae44168e433c4b58f15f03987100eb95742892da
S:AD224AC0015C2280A651443E5F780D19E0873DB1 10.0.0.2:32005
Replicates f5fc306ac3e541e1539ca4345aa2fbdb493db787
M:f307234110ca4246c273f5a4eff3749eee6bd9b6 10.0.0.3:32001
slots:4681-7021 (2341 Slots) Master
m:f5fc306ac3e541e1539ca4345aa2fbdb493db787 10.0.0.3:32002
slots:11703-14042 (2340 Slots) Master
s:937ddb1c9854a0168ca66b36d3fba0c9ef392024 10.0.0.3:32003
Replicates a6182636a6dc7ba2339a425d85b7eabacdb55ed0
s:e56edb5eb3b00c4192b49696722c850d44c8888b 10.0.0.3:32004
Replicates 0939b70560b2ece64642ba021cfaec8be621c17a
S:5DB54925BDFD92A2AC06A5E5326BE82247E37B2A 10.0.0.3:32005
Replicates bca6171f8e6a53ca95e487b3e07d3e27e8d588c6
Can I Set the above configuration? (Type ' yes ' to accept): Yes
>>> Nodes Configuration Updated
>>> Assign a different config epoch to each node
>>> sending CLUSTER MEET messages to join the CLUSTER
Waiting for the cluster to join
>>> performing Cluster Check (using node 10.0.0.1:32001)
M:bca6171f8e6a53ca95e487b3e07d3e27e8d588c6 10.0.0.1:32001
slots:0-2340 (2341 Slots) Master
M:ae44168e433c4b58f15f03987100eb95742892da 10.0.0.1:32002
slots:7022-9361 (2340 Slots) Master
m:0939b70560b2ece64642ba021cfaec8be621c17a 10.0.0.1:32003
slots:14043-16383 (2341 Slots) Master
m:fa99bfc99d7e678ceeedd28242b69cd9e61ff05b 10.0.0.1:32004
Slots: (0 slots) Master
Replicates E364A7FB06FE9922EA81E7FC41C2891370D5A2AF
M:7ACDAA82E5D52DB1AC1BA209324C30EA62B3B5C3 10.0.0.1:32005
Slots: (0 slots) Master
Replicates F307234110ca4246c273f5a4eff3749eee6bd9b6
M:E364A7FB06FE9922EA81E7FC41C2891370D5A2AF 10.0.0.2:32001
slots:2341-4680 (2340 Slots) Master
M:a6182636a6dc7ba2339a425d85b7eabacdb55ed0 10.0.0.2:32002
slots:9362-11702 (2341 Slots) Master
M:2243EEC692146889D850B153E6E54458085C49B9 10.0.0.2:32003
Slots: (0 slots) Master
Replicates bca6171f8e6a53ca95e487b3e07d3e27e8d588c6
M:b4ef9345520868fa8a5b00355b3ef85a32821d56 10.0.0.2:32004
Slots: (0 slots) Master
Replicates Ae44168e433c4b58f15f03987100eb95742892da
M:AD224AC0015C2280A651443E5F780D19E0873DB1 10.0.0.2:32005
Slots: (0 slots) Master
Replicates f5fc306ac3e541e1539ca4345aa2fbdb493db787

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.