首页 > 其他 > 详细

Redis学习笔记#12 Redis Cluster 集群

时间:2020-04-28 14:09:26      阅读:49      评论:0      收藏:0      [点我收藏+]

Redis Cluster的模型

技术分享图片

 Redis Cluster 以hash slot的方式分片

There are 16384 hash slots in Redis Cluster, and to compute what is the hash slot of a given key, we simply take the CRC16 of the key modulo 16384.

开始创建3主3从的redis集群 

创建配置文件redis.conf

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

分别使用7000-7005这六个端口,注意port和cluster-config-file修改为对应端口

分别启动这六个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

技术分享图片

 技术分享图片

集群配置成功

 

进入集群控制台

 ./redis-cli -c -p 7000

技术分享图片

 

 重定向到7002上的slot

验证完成!

------------------------------------------------

参考资料:

https://www.jianshu.com/p/c869feb5581d

Redis学习笔记#12 Redis Cluster 集群

原文:https://www.cnblogs.com/sunang/p/12791984.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!