参考资料:https://www.cnblogs.com/yaozb/p/6911395.html

redis.conf 配置示例

bind 127.0.0.1
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes

创建集群

使用 redis-trib.rb 创建带副本的集群,6 个节点分布在 7000–7005 端口,7006 作为第七个节点:

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 127.0.0.1:7006

启动单个节点:

redis-server redis.conf

runcluster.bat

Windows 下批量启动所有节点的脚本:

cd 7000
start redis-server.exe  redis.conf
cd ..
start redis-server.exe  redis.conf
cd 7001
start redis-server.exe  redis.conf
cd ..
cd 7002
start redis-server.exe  redis.conf
cd ..
cd 7003
start redis-server.exe  redis.conf
cd ..
cd 7004
start redis-server.exe  redis.conf
cd ..
cd 7005
start redis-server.exe  redis.conf
cd ..
cd 7006
start redis-server.exe  redis.conf