首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

Redis集群研究和实践(基于redis 3.0.5)-3

Redis集群研究和实践(基于redis 3.0.5)-3

好了。最重要的时刻来临了,胜败成举在此了,啊啊啊啊啊啊,好激动:
[url=][/url]
[root@web3 7005]# 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>>> Creating clusterConnecting to node 127.0.0.1:7000: OKConnecting to node 127.0.0.1:7001: OKConnecting to node 127.0.0.1:7002: OKConnecting to node 127.0.0.1:7003: OKConnecting to node 127.0.0.1:7004: OKConnecting to node 127.0.0.1:7005: OK>>> Performing hash slots allocation on 6 nodes...Using 3 masters:127.0.0.1:7000127.0.0.1:7001127.0.0.1:7002Adding replica 127.0.0.1:7003 to 127.0.0.1:7000Adding replica 127.0.0.1:7004 to 127.0.0.1:7001Adding replica 127.0.0.1:7005 to 127.0.0.1:7002M: 3707debcbe7be66d4a1968eaf3a5ffaf4308efa4 127.0.0.1:7000slots:0-5460 (5461 slots) masterM: cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6c 127.0.0.1:7001slots:5461-10922 (5462 slots) masterM: dfa0754c7854a874a6ebd2613b86140ad97701fc 127.0.0.1:7002slots:10923-16383 (5461 slots) masterS: d2237fdcfbba672de766b913d1186cebcb6e1761 127.0.0.1:7003replicates 3707debcbe7be66d4a1968eaf3a5ffaf4308efa4S: 4b4aef8b48c427a3c903518339d53b6447c58b93 127.0.0.1:7004replicates cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6cS: 30858dbf483b61b9838d5c1f853a60beaa4e7afd 127.0.0.1:7005replicates dfa0754c7854a874a6ebd2613b86140ad97701fcCan 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 clusterWaiting for the cluster to join...>>> Performing Cluster Check (using node 127.0.0.1:7000)M: 3707debcbe7be66d4a1968eaf3a5ffaf4308efa4 127.0.0.1:7000slots:0-5460 (5461 slots) masterM: cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6c 127.0.0.1:7001slots:5461-10922 (5462 slots) masterM: dfa0754c7854a874a6ebd2613b86140ad97701fc 127.0.0.1:7002slots:10923-16383 (5461 slots) masterM: d2237fdcfbba672de766b913d1186cebcb6e1761 127.0.0.1:7003slots: (0 slots) masterreplicates 3707debcbe7be66d4a1968eaf3a5ffaf4308efa4M: 4b4aef8b48c427a3c903518339d53b6447c58b93 127.0.0.1:7004slots: (0 slots) masterreplicates cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6cM: 30858dbf483b61b9838d5c1f853a60beaa4e7afd 127.0.0.1:7005slots: (0 slots) masterreplicates dfa0754c7854a874a6ebd2613b86140ad97701fc[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage...[OK] All 16384 slots covered.[url=][/url]



哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈。终于他妈的成功了!!!!
Redis-trib会提示你做了什么配置, 输入yes接受. 集群就被配置和加入了, 意思是, 实例会经过互相交流后启动。
测试集群的状态:
[url=][/url]
[root@web3 7000]# redis-trib.rb check 127.0.0.1:7000Connecting to node 127.0.0.1:7000: OKConnecting to node 127.0.0.1:7002: OKConnecting to node 127.0.0.1:7003: OKConnecting to node 127.0.0.1:7005: OKConnecting to node 127.0.0.1:7001: OKConnecting to node 127.0.0.1:7004: OK>>> Performing Cluster Check (using node 127.0.0.1:7000)M: 3707debcbe7be66d4a1968eaf3a5ffaf4308efa4 127.0.0.1:7000slots:0-5460 (5461 slots) master1 additional replica(s)M: dfa0754c7854a874a6ebd2613b86140ad97701fc 127.0.0.1:7002slots:10923-16383 (5461 slots) master1 additional replica(s)S: d2237fdcfbba672de766b913d1186cebcb6e1761 127.0.0.1:7003slots: (0 slots) slavereplicates 3707debcbe7be66d4a1968eaf3a5ffaf4308efa4S: 30858dbf483b61b9838d5c1f853a60beaa4e7afd 127.0.0.1:7005slots: (0 slots) slavereplicates dfa0754c7854a874a6ebd2613b86140ad97701fcM: cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6c 127.0.0.1:7001slots:5461-10922 (5462 slots) master1 additional replica(s)S: 4b4aef8b48c427a3c903518339d53b6447c58b93 127.0.0.1:7004slots: (0 slots) slavereplicates cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6c[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage...[OK] All 16384 slots covered.[url=][/url]



可以看到有3个主节点,3个从节点。每个节点都是成功的连接状态。
3个主节点[M]是:
7000 (3707debcbe7be66d4a1968eaf3a5ffaf4308efa4)
7001 (cb5c04b6160c3b7e18cad5d49d8e2987b27e0d6c)
7002 (dfa0754c7854a874a6ebd2613b86140ad97701fc)
3个从节点[S]是:
7003 (d2237fdcfbba672de766b913d1186cebcb6e1761)->7000
7004 (4b4aef8b48c427a3c903518339d53b6447c58b93)->7001
7005 (30858dbf483b61b9838d5c1f853a60beaa4e7afd) ->7002
返回列表