栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

redis之sentinel集群

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

redis之sentinel集群

    linux部署
       redis创建
        图例

         

        docker-compose.yml文件

          version: '3'
          services:
            master:
              image: redis
              container_name: redis-master
              ports:
                - 6379:6379
            slave1:
              image: redis
              container_name: redis-master-1
              ports:
                - 6380:6379
              command: redis-server --slaveof redis-master 6379
            slave2:
              image: redis
              container_name: redis-master-2
              ports:
                - 6381:6379
              command: redis-server --slaveof redis-master 6379

          执行docker-compost up -d

      sentinell集群创建
        图例

          docker-compose.yml文件
            version: '3'
            services:
              sentinel1:
                image: redis
                container_name: redis-sentinel-1
                ports:
                  - 26379:26379
                command: redis-sentinel /usr/local/etc/redis/sentinel.conf
                volumes:
                  - ./sentinel1.conf:/usr/local/etc/redis/sentinel.conf
              sentinel2:
                image: redis
                container_name: redis-sentinel-2
                ports:
                  - 26380:26379
                command: redis-sentinel /usr/local/etc/redis/sentinel.conf
                volumes:
                    - ./sentinel2.conf:/usr/local/etc/redis/sentinel.conf
              sentinel3:
                image: redis
                container_name: redis-sentinel-3
                ports:
                  - 26381:26379
                command: redis-sentinel /usr/local/etc/redis/sentinel.conf
                volumes:
                    - ./sentinel3.conf:/usr/local/etc/redis/sentinel.conf
             
          sentinel1.conf文件,sentinel2.conf文件,sentinel3.conf文件
            port 26379
            dir /tmp
            #自定义集群名,其中127.0.0.1为redis-master的ip. 6379 为redis-master的端口. 2为最小投票数(因为有三台sentinel  所以设置成 2)
            sentinel monitor mymaster 192.168.31.39 6379 2
            sentinel down-after-milliseconds mymaster 30000
            sentinel failover-timeout mymaster 180000
            sentinel parallel-syncs mymaster 1
            sentinel deny-scripts-reconfig yes
             
          执行docker-compost up -d
        测试
          执行docker exec -it redis-sentinel-1 bash执行redis-cli -p 26379(sentinel的端口号)执行sentinel master mymaster(sentinel的名字)如果有以下这种情况,则成功RedisDesktopManager管理工具连接

             

        springboot对接sentinel集群案例链接
          https://gitee.com/lxf-spring-cloud-demo/spring-cloud-redis
      转载请注明:文章转载自 www.mshxw.com
      本文地址:https://www.mshxw.com/it/757643.html
      我们一直用心在做
      关于我们 文章归档 网站地图 联系我们

      版权所有 (c)2021-2022 MSHXW.COM

      ICP备案号:晋ICP备2021003244-6号