1. 集群之间的通信
各个数据库相互通信,保存各个库中槽的编号数据
一次命中,直接返回
一次未命中,告知具体位置
2. 集群配置
- 修改redis.conf
# 开启集群
cluster-enabled yes
# 设置集群配置文件,每个服务器要不一样
cluster-config-file node-6379.conf
# 设置下线时间
cluster-node-timeoout 10000
- 依次启动集群服务
redis-server redis-6379.conf
- 将redis服务连接起来
需要执行src目录下的redis-trib.rb,且需要ruby环境
下列命名表示1个master有1个slave,且一共有6个服务器
./redis-trib.rb create --replicas 1 \
127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 \
127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384
3. 集群开启
进入客户端,需要加-c参数
redis-cli -c
来源:CSDN
作者:KeithRong
链接:https://blog.csdn.net/weixin_42103026/article/details/104156891