香港云服务器Redis集群如何水平扩容

已关闭留言

香港云服务器Redis集群水平扩容的示例:

1.加入新的master

mkdir -p /var/redis/7007

修改配置文件信息 /etc/redis/7007.conf

port 7007

cluster-enabled yes

cluster-config-file /etc/redis-cluster/node-7007.conf

cluster-node-timeout 15000

daemonize yes

pidfile /var/run/redis_7007.pid

dir /var/redis/7007

logfile /var/log/redis/7007.log

bind 192.168.31.227

appendonly yes

启动脚本 /etc/init.d/redis_7007

redis-trib.rb add-node 192.168.1.107:7007 192.168.1.107:7001

redis-trib check 192.168.1.107:7001

2.reshared数据,slot从一些master移动到新的master,达到扩容减轻其他主节点的压力,代码:

redis-trib.rb reshared 192.168.1.107:7001