redis集群模式启动

最低集群配置

官方的最低集群配置是3个master和3个slave,一个master对应一个slave。
6个redis的配置分别如下

#redis1.conf
port 7000
cluster-enabled yes
cluster-config-file nodes1.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
#redis1-1.conf
port 7001
cluster-enabled yes
cluster-config-file nodes1-1.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
#redis2.conf
port 7002
cluster-enabled yes
cluster-config-file nodes2.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
#redis2-1.conf
port 7003
cluster-enabled yes
cluster-config-file nodes2-1.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
#redis3.conf
port 7004
cluster-enabled yes
cluster-config-file nodes3.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
#redis3-1.conf
port 7005
cluster-enabled yes
cluster-config-file nodes3-1.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes

依次执行./redis-server redis*.conf启动6个redis服务器进程
最后执行:
redis-cli --cluster create 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 --cluster-replicas 1

你可能感兴趣的:(C++)