redis-trib.rb create --replicas 1 $IP_main:9000 $IP_main:9001 $IP_main:9002 $IP_cong:9003 $IP_cong:9004 $IP_cong:9005

Creating cluster
Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.100.83:9000
192.168.100.81:9003
192.168.100.83:9001
Adding replica 192.168.100.81:9004 to 192.168.100.83:9000
Adding replica 192.168.100.83:9002 to 192.168.100.81:9003
Adding replica 192.168.100.81:9005 to 192.168.100.83:9001
M: 6604edb1779b604b3fd3808731ebf13743ca8777 192.168.100.83:9000
slots:0-5460 (5461 slots) master
M: 91c8b6ea6738286a4c758e4036a4b40c359dcc1f 192.168.100.83:9001
slots:10923-16383 (5461 slots) master
S: 7b30c14b752c92a62683260dd45039703f3a1034 192.168.100.83:9002
replicates e0d8781fb0f5055b355325ca126c4454676e92ac
M: e0d8781fb0f5055b355325ca126c4454676e92ac 192.168.100.81:9003
slots:5461-10922 (5462 slots) master
S: a3f497fcc4c74333c87fddc01bf1c1895b744e77 192.168.100.81:9004
replicates 6604edb1779b604b3fd3808731ebf13743ca8777
S: dec4ff9abdf10bc3ceea40eb4acc01c6a085f858 192.168.100.81:9005
replicates 91c8b6ea6738286a4c758e4036a4b40c359dcc1f
Can I set the above configuration? (type 'yes' to accept): yes
/usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:350:in rescue in establish_connection': Error connecting to Redis on 192.168.100.83:9000 (Errno::ECONNREFUSED) (Redis::CannotConnectError)
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:334:in
establish_connection'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:104:in block in connect'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:296:in
with_reconnect'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:103:in connect'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:369:in
ensure_connected'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:224:in block in process'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:309:in
logging'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:223:in process'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis/client.rb:123:in
call'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis.rb:2855:in block in cluster'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis.rb:50:in
block in synchronize'
from /usr/local/lib/ruby/2.2.0/monitor.rb:211:in mon_synchronize'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis.rb:50:in
synchronize'
from /usr/local/lib/ruby/gems/2.2.0/gems/redis-4.0.3/lib/redis.rb:2854:in cluster'
from /usr/local/bin/redis-trib.rb:212:in
flush_node_config'
from /usr/local/bin/redis-trib.rb:776:in block in flush_nodes_config'
from /usr/local/bin/redis-trib.rb:775:in
each'
from /usr/local/bin/redis-trib.rb:775:in flush_nodes_config'
from /usr/local/bin/redis-trib.rb:1296:in
create_cluster_cmd'
from /usr/local/bin/redis-trib.rb:1701:in `

'

提示不能建立连接,重启redis,解决

转载:https://www.cnblogs.com/syq816/p/9009777.html

2 ./redis-trib.rb 报错:/usr/local/rvm/gems/ruby-2.4.2/gems/redis-4.0.1/lib/redis/client.rb:119:in `call': ERR Slot 0 is already busy (Redis::CommandError)
错误提示是

  slot插槽被占用了(这是 搭建集群前时,以前redis的旧数据和配置信息没有清理干净。)

解决方案是

      用redis-cli 登录到每个节点执行  flushall  和 cluster reset  就可以了。

然后重新执行群集脚本命令:

./redis-trib.rb create --replicas 1 192.168..:7001 192.168..:7002 192.168..:7003 192.168..:7004 192.168..:7005 192.168..:7006