【README】
创建集群报错 can't connect to node 192.168.163.203
[root@centos201 ~]# /usr/local/redis-cluster/bin/redis-trib.rb create --replicas 0 192.168.163.201:6379 192.168.163.202:6379 192.168.163.203:6379
>>> Creating cluster
Connecting to node 192.168.163.201:6379: OK
Connecting to node 192.168.163.202:6379: OK
Connecting to node 192.168.163.203:6379: [ERR] Sorry, can't connect to node 192.168.163.203:6379
【1】解决方法
切换到 203机器,关闭其防火墙;
systemctl stop firewalld.service
【2】再次创建redis集群
--replicas 参数为0 ,表示0个副本,即所有节点全部是 master
[root@centos201 ~]# /usr/local/redis-cluster/bin/redis-trib.rb create --replicas 0 192.168.163.201:6379 192.168.163.202:6379 192.168.163.203:6379
>>> Creating cluster
Connecting to node 192.168.163.201:6379: OK
Connecting to node 192.168.163.202:6379: OK
Connecting to node 192.168.163.203:6379: OK
>>> Performing hash slots allocation on 3 nodes...
Using 3 masters:
192.168.163.201:6379
192.168.163.202:6379
192.168.163.203:6379
M: 5571f088f9d8798dd0c2e973ced830c2cd8033a2 192.168.163.201:6379
slots:0-5460 (5461 slots) master
M: 99a3516a03612dba4b73c32e7e1e03ff1145a660 192.168.163.202:6379
slots:5461-10922 (5462 slots) master
M: 5c0ea563b464e58dd8dc9722cdfcb97a85c44714 192.168.163.203:6379
slots:10923-16383 (5461 slots) master
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 192.168.163.201:6379)
M: 5571f088f9d8798dd0c2e973ced830c2cd8033a2 192.168.163.201:6379
slots:0-5460 (5461 slots) master
M: 99a3516a03612dba4b73c32e7e1e03ff1145a660 192.168.163.202:6379
slots:5461-10922 (5462 slots) master
M: 5c0ea563b464e58dd8dc9722cdfcb97a85c44714 192.168.163.203:6379
slots:10923-16383 (5461 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
bingo !
创建redis集群成功 !