错误演示:
[root@small_vpn57 bin]# redis-trib.rb create --replicas 1 192.168.4.51:6351 192.168.4.52:6352 192.16
8.4.53:6353 192.168.4.54:6354 192.168.4.55:6355 192.168.4.56:6356
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.4.51:6351
192.168.4.52:6352
192.168.4.53:6353
Adding replica 192.168.4.55:6355 to 192.168.4.51:6351
Adding replica 192.168.4.56:6356 to 192.168.4.52:6352
Adding replica 192.168.4.54:6354 to 192.168.4.53:6353
M: 1729c0d2eb9f9c6524c0e8748893feeb68eac7ed 192.168.4.51:6351
slots:0-16383 (16384 slots) master
M: 29efab845b703d9fbe75daae4baee810bde1470b 192.168.4.52:6352
slots:0-16383 (16384 slots) master
M: 7a61e278279c2f49365f57e1533d7c7751aed1dc 192.168.4.53:6353
slots:0-16383 (16384 slots) master
S: bfb1037a623370a4f937027644c65dbfea545415 192.168.4.54:6354
replicates 7a61e278279c2f49365f57e1533d7c7751aed1dc
S: 30b8ac3bf9cfe107ead9f72d7d9722f64fb45ca5 192.168.4.55:6355
replicates 1729c0d2eb9f9c6524c0e8748893feeb68eac7ed
S: af830ee7295729502f4c6e796ab499ef38cd204f 192.168.4.56:6356
replicates 29efab845b703d9fbe75daae4baee810bde1470b
Can I set the above configuration? (type 'yes' to accept): yes
/usr/local/share/gems/gems/redis-3.2.1/lib/redis/client.rb:113:in `call': ERR Slot 0 is already busy (Redis::CommandError)
from /usr/local/share/gems/gems/redis-3.2.1/lib/redis.rb:2556:in `block in method_missing'
from /usr/local/share/gems/gems/redis-3.2.1/lib/redis.rb:37:in `block in synchronize'
from /usr/share/ruby/monitor.rb:211:in `mon_synchronize'
from /usr/loca
l/share/gems/gems/redis-3.2.1/lib/redis.rb:37:in `synchronize'
from /usr/local/share/gems/gems/redis-3.2.1/lib/redis.rb:2555:in `method_missing'
from ./redis-trib.rb:212:in `flush_node_config'
from ./redis-trib.rb:906:in `block in flush_nodes_config'
from ./redis-trib.rb:905:in `each'
from ./redis-trib.rb:905:in `flush_nodes_config'
from ./redis-trib.rb:1426:in `create_cluster_cmd'
from ./redis-trib.rb:1830:in `<main>'
redis服务器:192.168.4.(51-56)
管理主机:small_vpn57(192.168.4.57)
客户端:small_vpn51(192.168.4.50)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201104121743316.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3loaDU2MTg=,size_16,color_FFFFFF,t_70#pic_center)
解决办法:找到6台主机的配置文件
[root@small_vpn51 ~]# vim /etc/redis/6379.conf
823 cluster-config-file nodes-6351.conf #此处6351根据端口改成不同的,如果相同可能出现如上错误原因:
nodes.conf文件不能设置成相同的名字
目录:/var/lib/redis/6379/nodes-6379.conf