Redis3.2 Cluster

1.downloadredis3.2

2.makePREFIX=/usr/local/redis/install

3.拷贝配置文件到安装文件cp/usr/soft/redis-3.0.7/redis.conf/usr/local/redis/bin/

4.安装完后,只有BIN文件夹,

5.yuminstallruby

yuminstallrubygems

redis3asrubyversion1.9.3

https://leonard.io/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/

downloadredis3.0.gem

geminstall/usr/local/redis-3.0.0.gem

6.建立,7000,7001,8000,8001,9000,9001六个文件夹

7.讲单个安装成功的BIN文件夹拷贝到上述文件夹

8.修改各个文件夹的redis.conf,修改IP地址,端口号,node

binip

cluster-enabledyes

cluster-config-filenodes-7000.conf

9.后台启动六个实例

./7000/bin/redis-server./7000/bin/redis.conf&

./7001/bin/redis-server./7001/bin/redis.conf&

./9001/bin/redis-server./9001/bin/redis.conf&

9.拷贝redis-trib.rb

10./redis-trib.rbcreate--replicas1192.168.24.2:7000192.168.24.2:7001192.168.24.2:8000192.168.24.2:8001192.168.24.2:9000192.168.24.2:9001

Addingreplica192.168.24.2:8001to192.168.24.2:7000

Addingreplica192.168.24.2:9000to192.168.24.2:7001

Addingreplica192.168.24.2:9001to192.168.24.2:8000

M:f6ea3bbef16503d8549a469e40d4e0081a512676192.168.24.2:7000

slots:0-5460(5461slots)master

M:ff3c32d5262d58c64f9ba08232a7adb6c7bd20ca192.168.24.2:7001

slots:5461-10922(5462slots)master

M:7905678084be3563ce45c70010013fbc70b42ed2192.168.24.2:8000

slots:10923-16383(5461slots)master

S:960400d6c464f4fe5f5f11fc5d9a118ced3013b9192.168.24.2:8001

replicatesf6ea3bbef16503d8549a469e40d4e0081a512676

S:28bcb88ca5f5dae73dff694db06dd702a8432f37192.168.24.2:9000

replicatesff3c32d5262d58c64f9ba08232a7adb6c7bd20ca

S:e06b00683702b67fd0e6b72f83069a02a708cfc1192.168.24.2:9001

replicates7905678084be3563ce45c70010013fbc70b42ed2

11.登录到集群

./7000/bin/redis-cli-h192.168.24.2-p7000-c

-c表示连接到集群

测试,ping

pong

查看集群信息

clusterinfo

12添加主节点

./redis-trib.rbadd-node192.168.198.130:7007192.168.198.130:7001

重新分配槽数量

./redis-trib.rbreshard192.168.198.130:7001(连接集群中任意一个可用结点都行)

13.添加从节点

./redis-trib.rbadd-node--slave--master-iddb786026ed607786d6db1aaab94fd73d1ac3c8f4192.168.198.130:7008192.168.198.130:7001

重新分配槽数量

./redis-trib.rbreshard192.168.198.130:7001(连接集群中任意一个可用结点都行)

cankaowenzhang

http://www.cnblogs.com/mouseIT/p/5288204.html

相关推荐