redis集群部署方案

方案一:在portainer上进行安装

#如果集群故障了,则所有节点重启一次即可  如果单独重启了启动节点  则把启动节点数改为0  不然会一直在重启
version: '3.8'

#网络模式配置  redis集群固定要用host模式
x-common-ports: &common-ports 
      protocol: tcp
      mode: host
      
#日志大小设置
x-logging: &default-logging
  options:
    max-size: "3g"
    max-file: "1"
  driver: json-file
      
#公共参数
x-common-setting: &common-setting 
    image: master:5000/redis:5.0.7
    logging: *default-logging
    restart: always
    networks:
      - default

#集群启动节点 
x-common-startup-setting: &common-startup-setting 
    << : *common-setting
    deploy:
      restart_policy:
        condition: on-failure 
    
#redis工作节点的资源配置
x-common-worker-deploy-resources: &common-worker-deploy-resources 
      resources:
        limits:
          memory: 1030M
        reservations:
          memory: 1030M
        
#redis工作节点的基础配置
x-common-worker-setting: &common-worker-setting 
    << : *common-setting
    entrypoint:
      - "redis-server"
      - "--bind 0.0.0.0" 
      - "--cluster-enabled"
      - "yes"
      - "--cluster-config-file"
      - "nodes.conf"
      - "--cluster-node-timeout"
      - "5000"
      - "--requirepass"
      - "37621040"
      - "--masterauth"
      - "37621040"
      - "--maxmemory"
      - "1024MB"
      - "--maxmemory-policy"
      - "volatile-lru"
      - "--appendonly"
      - "yes"      
      
services:       
  redis-startup:
    << : *common-startup-setting
    command:   
      - "/bin/bash"
      - "-c"      
      #主从模式 至少6个工作节点
      - "redis-cli -h 192.168.35.210 -p 26379 -a 37621040 --cluster create 192.168.35.210:26379 192.168.35.211:26380 192.168.35.212:26381 192.168.35.213:26382 192.168.35.214:26383 192.168.35.215:26384 --cl
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值