80 to 192.168.188.38:6379
Adding replica 192.168.188.38:6380 to 192.168.188.28:6379
Adding replica 192.168.188.18:6380 to 192.168.188.18:6379
M: 53c202561155d141a8e24d42bb8eb2907998fce9 192.168.188.18:6379
slots:10923-16383 (5461 slots) master
M: 654c0a7853724fe33683f54e8df665993ea704ed 192.168.188.28:6379
slots:5461-10922 (5462 slots) master
M: b4cc74e0ac6ec9b634d93e86fdb376b4d89dc318 192.168.188.38:6379
slots:0-5460 (5461 slots) master
S: ee3d5f85034e5a3c9d9369357b545d0a92751728 192.168.188.18:6380
replicates 53c202561155d141a8e24d42bb8eb2907998fce9
S: 10b558217d6618093b87f75a453ca39679bbcdf4 192.168.188.28:6380
replicates b4cc74e0ac6ec9b634d93e86fdb376b4d89dc318
S: 5dc55e90d3d3b56502a319ec9845e901102cfa6c 192.168.188.38:6380
replicates 654c0a7853724fe33683f54e8df665993ea704ed
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.188.18:6379)
M: 53c202561155d141a8e24d42bb8eb2907998fce9 192.168.188.18:6379
slots:10923-16383 (5461 slots) master
M: 654c0a7853724fe33683f54e8df665993ea704ed 192.168.188.28:6379
slots:5461-10922 (5462 slots) master
M: b4cc74e0ac6ec9b634d93e86fdb376b4d89dc318 192.168.188.38:6379
slots:0-5460 (5461 slots) master
M: ee3d5f85034e5a3c9d9369357b545d0a92751728 192.168.188.18:6380
slots: (0 slots) master
replicates 53c202561155d141a8e24d42bb8eb2907998fce9
M: 10b558217d6618093b87f75a453ca39679bbcdf4 192.168.188.28:6380
slots: (0 slots) master
replicates b4cc74e0ac6ec9b634d93e86fdb376b4d89dc318
M: 5dc55e90d3d3b56502a319ec9845e901102cfa6c 192.168.188.38:6380
slots: (0 slots) master
replicates 654c0a7853724fe33683f54e8df665993ea704ed
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
四,测试验证
调整主从状态
登录redis集群:
设置192.168.188.18:6380为192.168.188.28:6379的从
redis-cli -c -p 6380 -h 192.168.188.18
192.168.188.18:6380> cluster replicate 654c0a7853724fe33683f54e8df665993ea704ed
OK
设置192.168.188.38:6380为192.168.188.18:6379的从
redis-cli -c -p 6380 -h 192.168.188.38
192.168.188.38:6380> cluster replicate 53c202561155d141a8e24d42bb8eb2907998fce9
OK
最后保存配置到硬盘
192.168.188.38:6380> cluster saveconfig
OK
检查集群状态:
redis-trib.rb check 192.168.188.18:6379
>>> Performing Cluster Check (using node 192.168.188.18:6379)
M: 53c202561155d141a8e24d42bb8eb2907998fce9 192.168.188.18:6379
slots:10923-16383 (5461 slots) master
1 additional replica(s)
S: 5dc55e90d3d3b56502a319ec9845e901102cfa6c 192.168.188.38:6380
slots: (0 slots) slave
replicates 53c202561155d141a8e24d42bb8eb2907998fce9
M: 654c0a7853724fe33683f54e8df665993ea704ed 192.168.188.28:6379
slots:5461-10922 (5462 slots) master
1 additional replica(s)
S: 10b558217d6618093b87f75a453ca39679bbcdf4 192.168.188.28:6380
slots: (0 slots) slave
replicates b4cc74e0ac6ec9b634d93e86fdb376b4d89dc318
S: ee3d5f85034e5a3c9d9369357b545d0a92751728 192.168.188.18:6380
slots: (0 slots) slave
replicates 654c0a7853724fe33683f54e8df665993ea704ed
M: b4cc74e0ac6ec9b634d93e86fdb376b4d89dc318 192.168.188.38:6379
slots:0-5460 (5461 slots) master
1 addit