当前位置: 首页>后端>正文

redis 集群

CLUSTER 配置

# 开启CLUSTER
cluster-enabled yes
# 配置文件
cluster-config-file nodes.conf
# 节点超时时间
cluster-node-timeout 5000
# aof开启
appendonly yes
# 创建cluster,最后的1代表1主1从
redis-cli --cluster create 192.168.184.131:8010 192.168.184.131:8011 192.168.184.131:8012 192.168.184.131:8013 192.168.184.131:8014 192.168.184.131:8015  --cluster-replicas 1

# 查看信息
redis-cli --cluster check 192.168.184.131:8010

# 进入集群模式控制台
redis-cli -c -a 123456 -h 192.168.184.131 -p 8010

# 集群信息
cluster info
# 节点信息
cluster nodes

SpringBoot 集成Redis集群-配置

spring:
  redis:
    database: 1
    password: 123456
    cluster:
      nodes: 192.168.184.131:8010 192.168.184.131:8011 192.168.184.131:8012 192.168.184.131:8013 192.168.184.131:8014 192.168.184.131:8015

可参考:docker compose安装redis集群、集群扩容、集群收缩_cluster-announce-ip_Xiao--Y的博客-CSDN博客


https://www.xamrdz.com/backend/33k1925147.html

相关文章: